---
title: requestWhenInUseAuthorization()
framework: corelocation
role: symbol
role_heading: Instance Method
path: corelocation/cllocationmanager/requestwheninuseauthorization()
---

# requestWhenInUseAuthorization()

Requests the user’s permission to use location services while the app is in use.

## Declaration

```swift
func requestWhenInUseAuthorization()
```

## Discussion

Discussion You must call this method or requestAlwaysAuthorization() before you can receive location-related information. You may call requestWhenInUseAuthorization() whenever the current authorization status is not determined (CLAuthorizationStatus.notDetermined). important: Your app must be in the foreground to show a location authorization prompt. 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 NSLocationWhenInUseUsageDescription key in your app Info.plist 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.  |   |   |   |  After the user makes a selection and determines the status, the location manager delivers the results to the delegate’s locationManager(_:didChangeAuthorization:) method. If the initial authorization status is anything other than CLAuthorizationStatus.notDetermined, this method does nothing and doesn’t call the locationManager(_:didChangeAuthorization:) method. 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 (CLAuthorizationStatus.notDetermined). For information about when an app is considered to be in use, see Choosing the  Location Services Authorization to Request. 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. note: In iOS 16 and later, apps that actively track a user’s location or that have recently enabled Core Location display an indicator in Control Center. Be mindful of battery use and user privacy by monitoring the device’s location only when necessary and when the user expects it.

## Topics

### Related Documentation

- [Handling location updates in the background](corelocation/handling-location-updates-in-the-background.md)
- [NSLocationWhenInUseUsageDescription](bundleresources/information-property-list/nslocationwheninuseusagedescription.md)

## See Also

### Requesting authorization for location services

- [requestAlwaysAuthorization()](corelocation/cllocationmanager/requestalwaysauthorization().md)
- [requestTemporaryFullAccuracyAuthorization(withPurposeKey:completion:)](corelocation/cllocationmanager/requesttemporaryfullaccuracyauthorization(withpurposekey:completion:).md)
- [requestTemporaryFullAccuracyAuthorization(withPurposeKey:)](corelocation/cllocationmanager/requesttemporaryfullaccuracyauthorization(withpurposekey:).md)
- [authorizationStatus](corelocation/cllocationmanager/authorizationstatus-swift.property.md)
- [CLAuthorizationStatus](corelocation/clauthorizationstatus.md)
- [NSLocationDefaultAccuracyReduced](bundleresources/information-property-list/nslocationdefaultaccuracyreduced.md)
- [NSLocationAlwaysAndWhenInUseUsageDescription](bundleresources/information-property-list/nslocationalwaysandwheninuseusagedescription.md)
