Я использую код, указанный ниже, чтобы получить значение высоты
-(void)awakeFromNib {
locmanager = [[CLLocationManager alloc] init];
[locmanager setDelegate:self];
[locmanager setDesiredAccuracy:kCLLocationAccuracyBest];
[locmanager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
heightMesurement.text = [NSString stringWithFormat: @"%.2f m", newLocation.altitude];
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
heightMesurement.text = @"0.00 m";
}
Вызывается метод didUpdateToLocation, и я получаю значение высоты как нулевое при печати heightMesurement.text.
Может кто-нибудь дать мне представление, почему это происходит именно так и как это исправить.
Спасибо всем,
Мониш.