I'm writing an App with a mapView showing some Annotations.
Now I want to show the User's current location in the mapView. I get the current Location using this code:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)location
I get the details of the current location in the Log
2013-10-14 12:03:34.291 AppName[13200:a0b] (
"<+7.35000000,+47.32000000> +/- 5.00m (speed -1.00 mps / course -1.00) @ 10/14/13, 12:03:34 PM Central European Summer Time")
Now I don't get the location into the mapView as this blue pulsing dot.
Please give some hints.
In xCode 9 you could do it with storyboard file
You can enable the userlocation by this:
mapView.showsUserLocation = YES;
if you want to center on this location:
[mapView setCenterCoordinate:mapView.userLocation.location.coordinate animated:YES];
if you are using:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]]) {
return nil;
}
// etc...
}
In iOS10 I could not get the blue dot for the user location to show until adding the key NSLocationWhenInUseUsageDescription to my Info.plist, with a string description of how location info would be used in the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With