<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreLocation",
  "identifier" : "/documentation/CoreLocation/CLLocationManager/requestWhenInUseAuthorization()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Location"
    ],
    "preciseIdentifier" : "c:objc(cs)CLLocationManager(im)requestWhenInUseAuthorization"
  },
  "title" : "requestWhenInUseAuthorization()"
}
-->

# requestWhenInUseAuthorization()

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

```
func requestWhenInUseAuthorization()
```

## Discussion

You must call this method or [`requestAlwaysAuthorization()`](/documentation/CoreLocation/CLLocationManager/requestAlwaysAuthorization()) before you can receive location-related information. You may call [`requestWhenInUseAuthorization()`](/documentation/CoreLocation/CLLocationManager/requestWhenInUseAuthorization()) whenever the current authorization status is not determined ([`CLAuthorizationStatus.notDetermined`](/documentation/CoreLocation/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 <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/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.

|Option               |Authorization                                                                     |
|---------------------|----------------------------------------------------------------------------------|
|Allow While Using App|When In Use authorization that does not expire.                                   |
|Allow Once           |Temporary When In Use authorization that expires when the app is no longer in use.|
|Don’t Allow          |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 [`locationManager(_:didChangeAuthorization:)`](/documentation/CoreLocation/CLLocationManagerDelegate/locationManager(_:didChangeAuthorization:)) method. If the initial authorization status is anything other than [`CLAuthorizationStatus.notDetermined`](/documentation/CoreLocation/CLAuthorizationStatus/notDetermined), this method does nothing and doesn’t call the [`locationManager(_:didChangeAuthorization:)`](/documentation/CoreLocation/CLLocationManagerDelegate/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`](/documentation/CoreLocation/CLAuthorizationStatus/notDetermined)). For information about when an app is considered to be in use, see <doc://com.apple.documentation/documentation/BundleResources/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](/documentation/CoreLocation/handling-location-updates-in-the-background)

Configure your app to receive location updates when it isn’t running in the foreground.

  <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/NSLocationWhenInUseUsageDescription>



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)