Requests permission to use location services whenever the app is running.
- iOS 8.0+
- watchOS 2.0+
- Core Location
When the current authorization status is
CLAuthorization, this method runs asynchronously and prompts the user to grant permission to the app to use location services. The user prompt contains the text from the
NSLocation key in your app’s
Info file, and the presence of that key is required when calling this method. After the status is determined, the location manager delivers the results to the delegate’s
location method. If the current authorization status is anything other than
CLAuthorization, this method does nothing and does not call the
location method, with one exception. If your app has never requested always authorization and its current authorization status is
CLAuthorization, you may call this method one time to try and change your app's authorization status to
You must call this method or the
request method prior to using location services. When the user grants “Always” authorization to your app, your app can start any of the available location services while your app is running in the foreground or background. In addition, services that allow your app to be launched in the background continue to do so.
For more information about the
NSLocation key, see Information Property List Key Reference.