I am using the code as I specified below to get the altitude value
-(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";
}
The didUpdateToLocation method is calling and I am getting the altitude value as null when I print heightMesurement.text.
Can anyone开发者_如何转开发 give me idea why this happening like this and how to rectify it.
Thanks to all, Monish.
精彩评论