Requests the user’s permission to use location services while the app is in use.
- iOS 8.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Core Location
You must call this method or
request before you can receive location-related information. You may call
request whenever the current authorization status is not determined (
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
Info file, and the presence of that key is required when calling this method. The user prompt displays the following options, which determine the authorization your app can receive.
Allow While Using App
When In Use authorization that does not expire.
Temporary When In Use authorization that expires when the app is no longer in use.
Denied; no further authorization requests are allowed.
After the user makes a selection and determines the status, the location manager delivers the results to the delegate's
location method. If the initial authorization status is anything other than
CLAuthorization, this method does nothing and doesn't call the
If the user's choice grants When In Use authorization to your app, your app can start any location service and is eligible to receive the results while it's in use. If the user's choice grants temporary When In Use authorization, the authorization expires when the app is no longer in use, reverting to Not Determined status (
CLAuthorization). For more details, see Understanding When an App is in Use.
When your app starts standard location services in the foreground, they continue to run in the background if your app has enabled background location updates in the Capabilities tab of your Xcode project. Attempts to start location updates while your app runs in the background will fail. The system displays a location services indicator in the status bar when your app moves to the background with active location services.