Location Access Request in iOS 11 Location Access Request in iOS 11 swift swift

Location Access Request in iOS 11


It is not optional anymore.

Since iOS 11 has been released, if your application requests the location to be always on (locationManager.requestAlwaysAuthorization()), the users will automatically be given all three options.

Unlike in previous iOS versions, all options have to be displayed to the user. That leads to: you have to add a key for both options.

Adapted from Apple's Article - Requesting Always Authorization:

You are required to include the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys in your app's Info.plist file. (If your app supports iOS 10 and earlier, the NSLocationAlwaysUsageDescription key is also required.) If those keys are not present, authorization requests fail immediately.

Reference: What's New in Location Technologies Video Session.


According to WWDC 2017 Session 713 about updates in Location technologies, you should always include When In Use description when linking against iOS 11 and later, if you want to request Always authorization. And iOS will additionally display an option to use location for When-In-Use mode.

Quote from session transcript.

So for iOS 11 we're asking all developers with Always requesting apps to additionally support the WhenInUse authorization mode. This change is both retroactive and forward-looking, so when the user updates to iOS 11, they will be able to authorize any app that requests Always authorization the WhenInUse authorization mode instead. If you link against the iOS 11 SDK, you must provide a WhenInUseUsageDescription. Otherwise, your app will be unable to request Always authorization. Furthermore, when your app requests Always authorization, we will additionally display an option to grant your app WhenInUse authorization instead. With these new three option prompts we have a new UsageDescription string as well. Your app needs to provide an AlwaysAndWhenInUse UsageDescription. Since this is a different key your app must provide it when you link against the new iOS 11 SDK. For apps linked against iOS 11 and later, Core Location will not use the old NSLocationAlways UsageDescription key.


When are not set you will catch a message in the debug console like:

The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with string values explaining to the user how the app uses this data

  1. Open Info.plist as Source Codeenter image description here

  2. And add the following xml chunk:

<key>NSLocationAlwaysUsageDescription</key><string>Location always usage description</string><key>NSLocationAlwaysAndWhenInUseUsageDescription</key><string>Location always and when in usage description</string><key>NSLocationUsageDescription</key><string>Location usage desription</string>