In Core Location, when a walker grants only approximate location, how do you request temporary full accuracy, and why can that request fail?
answer
- the Precise Location switch
- accuracyAuthorization and reducedAccuracy
- a purpose key in Info.plist
- a dictionary of temporary usage strings
- promptDeclined in three cases
basics
~10 sWhen accuracyAuthorization is .reducedAccuracy, call requestTemporaryFullAccuracyAuthorization(withPurposeKey:) with a key from NSLocationTemporaryUsageDescriptionDictionary. It fails with CLError.Code.promptDeclined if the key is missing, the app already has full accuracy, or it runs in the background.
solid answer
~40 sSince iOS 14 a person can turn off Precise Location for an app, and `CLLocationManager.accuracyAuthorization` then reads `.reducedAccuracy`: positions are snapped to an area roughly 5 km across, arrive less often and can be up to 20 minutes old, any `desiredAccuracy` other than `kCLLocationAccuracyReduced` has no effect, and region monitoring and beacon ranging are unavailable. When a feature truly needs precision, such as listing the nearest waiting dogs, call `requestTemporaryFullAccuracyAuthorization(withPurposeKey:)` (completion or `async` form) with a key defined in `NSLocationTemporaryUsageDescriptionDictionary`. A `nil` error only means the prompt was shown, so re-read `accuracyAuthorization`. The request fails with `promptDeclined` when the key is missing, full accuracy is already granted, or the app is in the background. The grant expires on its own, but not while the app stays in use.
code
plist · 5 lines<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
<key>NearbyDogs</key>
<string>Precise location lists the waiting dogs closest to you.</string>
</dict>go deeper
Recall that precise and approximate location are a separate switch from permission, and name accuracyAuthorization and its two values.
Explain what reduced accuracy does to positions, how the purpose key links code to Info.plist, and the three documented promptDeclined cases.
Request precision only at the moment a feature needs it, read the accuracy again after the prompt, and handle expiry and stale reduced fixes without loops.
Set a team rule for which features may ask for temporary precision, who words the purpose strings, and when approximate location is the product default.
## Precise and approximate location Since iOS 14 location permission has two independent parts. `authorizationStatus` says **whether** the app may use location; `accuracyAuthorization` says **how precisely**. The second is a `CLAccuracyAuthorization`: - `.fullAccuracy`: the app may set `desiredAccuracy` to any value and gets precise fixes. - `.reducedAccuracy`: the person switched off Precise Location for the app, either in the permission alert or later in Settings. The Core Location header spells out what reduced accuracy means. Location estimates have a horizontal accuracy on the order of 5 km, because Core Location snaps them to a nearby point that represents the area the device is in; estimates arrive less often; and apps should be ready for locations up to 20 minutes old. Setting `desiredAccuracy` to anything other than `kCLLocationAccuracyReduced` changes nothing, and **region monitoring and beacon ranging are not available**. Other services keep working at reduced accuracy. An app can also choose approximate location itself: adding `NSLocationDefaultAccuracyReduced` with the value `true` makes the authorization alert ask for approximate location by default, and setting `desiredAccuracy` to `kCLLocationAccuracyReduced` makes standard updates behave as if the app were approximate until you change it back. ## Requesting temporary full accuracy When one feature needs precision and the rest of the app does not, request it only for that moment: 1. Add `NSLocationTemporaryUsageDescriptionDictionary` to Info.plist. Each entry maps a key you choose, such as `NearbyDogs`, to the sentence the alert will show. The sentence can be localized through `InfoPlist.strings` under the same key. 2. When the walker opens the nearest-dogs list, check `accuracyAuthorization`. If it is `.fullAccuracy`, do nothing. 3. Otherwise call `requestTemporaryFullAccuracyAuthorization(withPurposeKey:completion:)`, or the `async throws` form `requestTemporaryFullAccuracyAuthorization(withPurposeKey:)`. 4. After it returns, read `accuracyAuthorization` again; `locationManagerDidChangeAuthorization(_:)` also fires when the accuracy level changes. The completion runs in the same threading context as the manager's delegate callbacks. A `nil` error means the prompt was displayed, **not** that the walker agreed. ## Why the request fails Apple's documentation lists three cases in which the request always fails with `CLError.Code.promptDeclined`: - the Info.plist dictionary has no entry for the purpose key you passed, so no alert can be built; - the app is already authorized for full accuracy; - the app is in the background. The header frames the full-accuracy and background cases as examples of Core Location deciding against a prompt, and says the completion then receives an error. Apple's advice is to log the error and try again the next time the person performs the action that needs precision, rather than retrying in a loop. ## How long the grant lasts Temporary full accuracy expires automatically, but expiry is postponed while the person is engaged with the app: while it is in the foreground, and while a continuous background location session is running with the background location indicator showing. That makes it suitable for session-shaped features, such as a navigation leg or a tracked walk, without asking for permanent precise access. | Situation | Approach | |---|---| | Nearby list only needs a neighbourhood | Accept reduced accuracy | | One feature needs precise fixes briefly | Temporary full accuracy with a purpose key | | App is designed around approximate location | `NSLocationDefaultAccuracyReduced` set to `true` | | iOS 18 code organised by workflow | `CLServiceSession(authorization:fullAccuracyPurposeKey:)` | ## Reading reduced positions safely Code that receives approximate positions should treat them as an area, not a point: - Read each `CLLocation`'s `horizontalAccuracy` and `timestamp` before using it; a reduced fix can be kilometres wide and minutes old. - Do not draw a route or measure a walk's distance from reduced fixes; the snapping makes short movements invisible. - Do not build a feature on region monitoring without checking `accuracyAuthorization` first; Apple's accuracy documentation says region monitoring is unavailable with reduced accuracy. - On iOS 18, a live update whose `accuracyLimited` flag is `true` reports that further updates are suspended for a while because of the accuracy limitation, which is a pause to show, not an error to retry. ## The iOS 18 declarative variant On iOS 18 a `CLServiceSession` created with `init(authorization:fullAccuracyPurposeKey:)` names an entry in the same dictionary, and Core Location asks for temporary full accuracy when needed while the session is held; its diagnostics report `fullAccuracyDenied` when the person refuses. The purpose-key dictionary is the same mechanism either way.
- Why does the nearest-dogs list sometimes show results from a street the walker left a while ago?With reduced accuracy, Core Location produces estimates less often and the header warns they can be up to 20 minutes old, snapped to a point representing a wide area. Check each `CLLocation`'s `timestamp` and `horizontalAccuracy` before using it, and if the list needs precision, request temporary full accuracy when the walker opens it.
- Does granting temporary full accuracy change authorizationStatus?No. `authorizationStatus` and `accuracyAuthorization` are separate values. A when-in-use app that gets temporary full accuracy stays `.authorizedWhenInUse`; only `accuracyAuthorization` moves to `.fullAccuracy`, and `locationManagerDidChangeAuthorization(_:)` fires for that change. When the grant expires, accuracy returns to reduced while the status stays the same.
Temporary full accuracy works like a visitor badge at an office: it is issued for a stated reason, stays valid while you are inside, and stops working on its own after you leave, so the next visit needs a new badge.
- Setting desiredAccuracy to kCLLocationAccuracyBest overrides the user's approximate choice.
- Any string works as the purpose key because it is only shown as text.
- A nil error in the completion means the user granted full accuracy.
- Temporary full accuracy stays granted until the app is deleted.
- Region monitoring keeps working with reduced accuracy, just less precisely.
Assumes an iOS 17 deployment target built with the iOS 27.1 SDK: accuracyAuthorization and the purpose-key request are iOS 14, and CLServiceSession's fullAccuracyPurposeKey variant is iOS 18.