iOS kCLAuthorizationStatusAuthorizedAlways

Gerriet M. Denkmann

My iOS 12 app has two modes;

1. needs kCLAuthorizationStatusAuthorizedWhenInUse
2. needs kCLAuthorizationStatusAuthorizedAlways

When the user has never been asked about kCLAuthorizationStatusAuthorizedAlways then requestAlwaysAuthorization shows a nice panel asking for permission and stating NSLocationAlwaysAndWhenInUseUsageDescription.

But when the user has once allowed “WhenInUse” but declined “Always” then no panel will come up.

In this case I would like to do:

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[ UIApplication.sharedApplication openURL: url options: [NSDictionary dictionary] completionHandler: …

But how do I know whether the user has been asked (and declined) this question already?

Also: I cannot always direct the user to the Settings app, because when the question about “Always” has never come up, there will be no option for “Always” in the Setting app.