IOS height issue

I have a problem getting height, it returns 0.0000. Here is my code:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSString *tAltitude = [NSString stringWithFormat:@"%f", [newLocation altitude]]; CLLocationCoordinate2D coord=newLocation.coordinate; MKCoordinateSpan span = {.latitudeDelta = 0.005, .longitudeDelta = 0.005}; MKCoordinateRegion region = {coord, span}; [map setRegion:region]; NSLog(@"Location: %@", [newLocation description]); NSLog(@"altitudine:%@",tAltitude); } 
+1
source share
1 answer

If you are indoors, the iPhone uses a memory location or WIFI location. This location will not return altitude. You must test the street to get GPS.

To make sure that you are using GPS, also check horizontal accuracy. If it is in the range of 2 digits, you should be on GPS, and most likely you will get an inscription at a height

+2
source

Source: https://habr.com/ru/post/1412913/


All Articles