IOS 8 does not ask for permission to host
My app has a map right in the first ViewController. On iOS 7, the Location Resolution popup will automatically open on first launch. However, on iOS 8, some changes are needed. I included the key NSLocationWhenInUseUsageDescription
in my Info.plist file, and in the AppDelegate I added:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// ...
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) {
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
[locationManager requestWhenInUseAuthorization];
}
// ...
}
However, the popup is never shown.
The user interface has a button to return the map to the user's location. In the buttons method, I included the same code as above to see if it helps.
This time, the popup appears, but it just blinks on the screen and the user cannot interact with it.
Under Settings> Privacy> Location Services> MyApp, there are two options that I expect: Never and When using an app. None of them are checked by default. Also, the "second explanation" I have set in Info.plist is shown correctly in the second option.
If I forcefully check the second option, the app works correctly, but I don't want the user to manually go through the options to enable it.
source to share