Requests the user’s permission for location services whether or not the app is in use.
- iOS 8.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- watchOS 2.0+
- Core Location
You must call this method or the
request method before you can receive location information. You may call
request when the current authorization state is either:
Not Determined (
Status .not Determined
When in Use (
Status .authorized When In Use
request method runs asynchronously. It prompts the user to grant permission to the app to use location services at any time, including when the user doesn’t know the app is running. To call this method, you must have
NSLocation keys in your app’s
This method displays two prompts: an initial prompt, and a second prompt that appears only after an event occurs that requires Always authorization. The initial prompt uses the purpose string from the
NSLocation key. The second prompt uses the purpose string from the
After the user responds to the initial prompt, your app receives one of the following states:
- Provisional Always
In this state, your app receives Always authorization in
location. However, when an event occurs that requires Always authorization, the system displays the second prompt. Users can decide at that time whether to grant (permanent) Always or When In Use authorization.
Manager(_: did Change Authorization:)
- Temporary When in Use
Expires when your app is no longer in use.
Core Location allows no further authorization requests.
Receive Permanent Always Authorization
Your app can receive permanent Always authorization if the user chooses to grant permission when the second prompt appears during the Provisional Always state. Your app will receive the following calls to your delegate’s
If the user chooses Always authorization, the system doesn’t call your delegate because it already has (provisional) Always authorization. Core Location removes the provisional status, making the Always authorization permanent and your app receives the location event.
If the user chooses When In Use authorization, the system calls your delegate with When In Use authorization. Your app does not receive the location event.
Your app can no longer ask for Always authorization after the user responds to this prompt. Calling this method again will have no effect.