此前的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