In my viewDidLoad
method I have
locationManager = [[CLLocationManager alloc]init]; // initializing locationManager
locationManager.delegate = self; // we set the delegate of locationManager to self.
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[locationManager requestWhenInUseAuthorization];
}
And the request is called, but the user is not prompted? Why?
You probably need to update your
plist
file. Here's a tutorial how to do it, quick & dirty:You need to do is to add one of the following keys to your Info.plist file:
You also need to request authorization for the corresponding location method,
WhenInUse
orBackground
. Use one of these calls:There's also a post that I found helpful:
Location Services not working in iOS 8
This answer details how to update your
plist
file:You'll probably want to customize and spell-check the strings of the dictionary entry that goes in the info.plist file before shipping the code.