Show User Location in MapView

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 xCode 9 you could do it with storyboard file

enter image description here


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.