此前的iOS 4.0,CoreLocation
正确报告的高度,现在,它始终为0英尺报告。的iOS CoreLocation海拔
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation *)oldLocation
{
NSString *tLatitude = [NSString stringWithFormat:@"%3.5f", newLocation.coordinate.latitude];
NSString *tLongitude = [NSString stringWithFormat:@"%3.5f", newLocation.coordinate.longitude];
/* the following returns 0 */
NSString *tAltitude = [NSString stringWithFormat:@"%i", newLocation.altitude];
/* theres more code, but it's not relevant,
and this worked prior to iOS 4.0*/
[manager stopUpdatingLocation];
}
不工作的设备,也没有模拟器,没有任何人遇到此问题?
您是在设备上还是在模拟器上测试此功能? – 2011-02-02 04:56:14
设备和模拟器。 – WrightsCS 2011-02-02 05:00:10