我正在使用iPhone模拟器4.2版本,试图显示或记录位置服务属性,例如纬度、经度、海拔高度、水平精度、垂直精度和速度等,但它没有显示正确的参数。在方向上,实际上事件并未触发,因为其执行了CLLocation代码。
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
[self.delegate locationUpdate:newLocation];
}
未执行CLHeading代码
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
[self.delegate headingUpdate:newHeading];
}
我在这两段代码中设置了断点,但它从未触及CLHeading代码。我在init方法中更新位置和方向。
- (id) init{
if (self!=nil) {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.distanceFilter = kCLDistanceFilterNone;
[self.locationManager startUpdatingLocation];
[self.locationManager startUpdatingHeading];
}
return self;
}
问题在于我不知道是由模拟器还是代码存在问题导致的?
请帮忙。