I am using the below code for displaying the user current location in iOS 8.4.
- (void)viewDidLoad
{
[super viewDidLoad];
[locationManager requestAlwaysAuthorization];
self.mapView.delegate = self;
[self.mapView setShowsUserLocation:YES];
locationManager = [[CLLocationManager alloc] init];
locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
}
But it is not working properly. It displays the following error:
Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.