skip to content

As lead of a dog-walking iOS app, how do you decide which Core Location authorization, accuracy and background mechanism each location feature asks for?

level: principalimportance: should knowfreq 30%

answer

  1. start from what each feature needs
  2. when-in-use is the default
  3. Always only for unattended work
  4. visits, significant change, standard
  5. one upgrade prompt, held sessions on iOS 18

basics

~20 s

Give each feature the weakest grant that works: when-in-use plus a background activity session for walks, reduced or temporary full accuracy for nearby lists, and Always only for an unattended visit log, requested when it is enabled.

solid answer

~50 s

I start from each feature's need, not from what Core Location allows. Route tracking runs only during a walk the walker started, so it uses when-in-use with live updates and a `CLBackgroundActivitySession`, whose blue indicator keeps it visible. The nearest-dogs list needs one fix at the moment of use, so `requestLocation()` or a short live-updates loop, with temporary full accuracy only if approximate is too coarse. Park entry during a walk can ride the same session; only park alerts with the app closed justify `CLMonitor` under Always. The daily places log is the one unattended feature: `startMonitoringVisits()` is the most power-efficient service, and relaunch needs Always. So the app asks for Always once, when the walker turns the log on, since the upgrade prompt appears only once, and on iOS 18 holds a `CLServiceSession(authorization: .always)` for that workflow. The trade-off is fewer approvals and stronger privacy versus features that work unattended.

go deeper

for a junior

Recall the two authorization levels, the precise location switch, and that visits, significant change and standard updates differ in power use.

for a middle

Explain which service each feature should use and why when-in-use plus a background session covers a walk the person started.

for a senior

Justify each grant against relaunch needs, the one-time upgrade prompt, reduced-accuracy limits and the iOS 18 service session rules.

for a principal

Own a written per-feature location policy, enforce it through one location service and review, and argue the trade-off between approvals, privacy and unattended features.

## The decision a lead owns Core Location lets an app ask for a lot: Always authorization, precise positions, continuous background updates, launches after termination. Each grant costs something. Always is asked through a one-time upgrade prompt the person may refuse, precise location is a separate switch people can turn off, and every running service uses battery the walker will notice. The lead's job is a per-feature policy that asks for the **least** that makes the feature work, written down so new screens do not quietly widen it. ## Start from the features The dog-walking app has four location features, and they need different things: | Feature | When it runs | Authorization | Accuracy | Mechanism | |---|---|---|---|---| | Record a walk's route | Walk started by the walker | When-in-use | Full, or temporary full | Live updates plus `CLBackgroundActivitySession` | | Nearest waiting dogs | Screen open | When-in-use | Reduced may do; temporary full if not | `requestLocation()` or a short live loop | | Walk enters the park | During a walk | When-in-use | Full | `CLMonitor`, or checks on the walk's own updates | | Log of places visited | All day, app closed | Always | Reduced is acceptable | `startMonitoringVisits()` | Only the last row runs unattended, so only it needs Always. ## Choosing the mechanism by power Apple ranks the services by cost: - **Visits** (`startMonitoringVisits()`) is the most power-efficient: the system notices places where the device stays and delivers `CLVisit` objects with an `arrivalDate`, a `departureDate` (`distantFuture` while the device is still there) and a coordinate. It is enabled for every manager in the app and survives relaunch. - **Significant change** (`startMonitoringSignificantLocationChanges()`) uses Wi-Fi and cellular rather than GPS and reports moves of roughly 500 meters, no more often than about every five minutes. It ignores `desiredAccuracy` and `distanceFilter`, so it suits refreshing a nearby-places set, not drawing a route. - **Standard updates** (`startUpdatingLocation()` or `liveUpdates`) are the most precise and the most expensive, and belong to the walk itself, stopped the moment the walk ends. ## Authorization: default to when-in-use When-in-use is Apple's preferred level and covers every feature the walker is actively using. Background walks do not need Always: a `CLBackgroundActivitySession` created when the walk starts keeps a when-in-use app in use, and the blue indicator shows the walker the tracking is happening. What Always adds that this app needs is relaunch: the system may **launch a terminated app** for significant-change, visit and region events. The visit log needs that; no other feature does. So the policy for Always is: 1. Ask only when the walker switches on the feature that needs it, after when-in-use is granted. 2. Add `NSLocationAlwaysAndWhenInUseUsageDescription` with a sentence about that feature. 3. Accept the answer. `requestAlwaysAuthorization()` from when-in-use works one time only, and is ignored after Allow Once; a declined upgrade means the feature falls back to running while the app is open. 4. On iOS 18, hold a `CLServiceSession(authorization: .always)` while the feature is on and retake it at launch, because without it an Always app does not receive live updates or `CLMonitor` events while not in use. ## Accuracy: ask for precision per moment Precise location is worth requesting only where an approximate position, snapped to an area about 5 km across, breaks the feature. The route needs precision; a visit log can live with reduced accuracy; the nearby list depends on how dense the walkers' areas are. Where precision is needed briefly, `requestTemporaryFullAccuracyAuthorization(withPurposeKey:)` scoped to that screen is better than demanding permanent precise access. An app that never needs precision can declare `NSLocationDefaultAccuracyReduced` and say so in its prompt. ## Keeping the policy enforced - Route all Core Location access through one location service object that owns the managers, sessions and monitors, so a new screen cannot start services on its own. - Keep the table above in the repository and review any change to Info.plist location keys or `UIBackgroundModes` against it. - Test each feature with a recorded GPX route in a test plan, and test the declined paths: denied, approximate, Always refused. - Treat stored locations as sensitive: Apple's Core Location documentation says to encrypt location data stored on disk or sent over the network. There is no single right answer; a team whose whole product is a passive day log will weigh Always differently. The defensible position is the one that can name, for every grant, the feature that needs it.

  • Product asks to request Always at first launch so the visit log is ready; what do you answer?
    Push back. A first-launch prompt has no context, so people are more likely to refuse, and Always can only be offered through a one-time upgrade after when-in-use. Ask for when-in-use at the first walk and for Always when the walker turns on the visit log, with a usage string about that log. If they decline, the log runs only while the app is open.
  • Would significant-change monitoring be a good substitute for visits in the places log?
    Usually not. Significant change reports moves of roughly 500 meters, no more often than about every five minutes, so it describes travel rather than places. Visits report where the device stayed, with arrival and departure dates, and are Apple's most power-efficient service. Significant change suits refreshing a nearby set, such as rotating monitored parks, and both need Always to relaunch a terminated app.

  • Request Always at first launch so every feature works later.
  • Precise accuracy everywhere is safer; battery is the system's problem.
  • Visit logging relaunches the app with when-in-use authorization.
  • Significant-change points are good enough to draw a walk's route.
  • If the Always upgrade is declined, simply request it again next launch.

Assumes an iOS 17 deployment target built with the iOS 27.1 SDK: live updates, CLMonitor and CLBackgroundActivitySession are iOS 17, CLServiceSession is iOS 18, and visits and significant-change monitoring predate both.