Highlight
iOS 14 expands Core Location authorization from “when the location can be accessed” to “how precise the location can be accessed”. Developers must handle both full and reduced precision, and only request temporary precise positioning when the function really needs it.
Core Content
In iOS 13, location authorization mainly answers one question: under what circumstances can the App access the location. Users can deny, allow access only for the duration of use, or allow access all the time. This model doesn’t answer another, more sensitive question: whether the app really needs to know the precise coordinates.
This lecture puts this issue into a specific scenario. For functions such as dating, local activities, and video region restrictions, many times you only need to know which city the user is roughly in. Navigation, running records, and reminders when leaving a certain place require precise location. The Precise switch in iOS 14 separates these two types of requirements, allowing users to authorize reduced accuracy (approximate location).
This changes how the Core Location code is judged. Got it beforeauthorizedWhenInUseFinally, many apps default to getting precise coordinates by themselves. After iOS 14, authorization status and precision status are two dimensions. Developers need to explain what different entrances such as UI, background capabilities, App Clips, and Widgets can do under reduced accuracy, and when they must be upgraded to full accuracy.
Detailed Content
There are no official Code tab clips for this session. Only the APIs, configuration items and behaviors that appear clearly in transcript are used below, and no code blocks are added.
Authorization status becomes two dimensions
(03:56)CLLocationManagerThe method of obtaining the authorization status has changed. Apple has deprecated the old class method and instead uses an instance property to represent the app’s current location authorization status. At the same time, newaccuracyAuthorizationInstance properties tell the App what it is currently gettingfullstillreducedAccuracy.
The corresponding delegate has also been updated. olddidChangeAuthorizationstatus callback is newlocationManagerDidChangeAuthorizationsubstitute. This callback will be inauthorizationStatusoraccuracyAuthorizationFires when any value changes.
Key points:
- Don’t just look at “whether authorized”. It also depends on “whether the accuracy is sufficient.”
- Positions with reduced accuracy still pass
didUpdateLocationsReturn, the type is stillCLLocation. - The returned object has
CLLocationCoordinate2Dcenter point and greater horizontal accuracy. - reduced accuracy Position is recalculated approximately four times per hour.
- This center point is not the user’s real coordinates, but only represents the center of the area containing the real location.
Temporary request full accuracy
(07:21) When the user only gives a rough location, but a function really requires a precise location, the App has two options. One is to send the user to Settings and have them turn on Precise permanently. The other is to useCLLocationManagerThe temporary full accuracy request method requests a precise location once during the current use.
The navigation entry of Maps is an example in the speech. Approximate location is enough to show large circles when browsing the map. When you start navigating from the current location, Maps interprets that it needs the exact location and then requests an upgrade.
Key points:
- Temporary upgrades are suitable for one-time tasks such as navigating from your current location.
- Purpose key must be provided when requesting.
- These descriptions should be placed in Info.plist
NSLocationTemporaryUsageDescriptionDictionaryDown. - Core Location will find the corresponding copy according to the purpose key and display it in the system authorization prompt.
- The life cycle of the temporary upgrade is similar to iOS 13’s Allow Once: it is valid while the user continues to use the app, and may be asked again the next time the user restarts and triggers the function.
The impact of reduced accuracy on background positioning
(11:22) There is no unified answer to background positioning. Different Core Location capabilities perform differently under reduced accuracy.
Significant location change monitoring will adapt to reduced accuracy. Updates are no more frequent than ordinary location updates, approximately four times per hour. Visit monitoring remains accurate in time, spatial information reduces accuracy. For example, the full accuracy App may receive “Arrived at a certain coordinate in Apple Park at 10:08”, and the reduced accuracy App will receive “Arrived at a certain coordinate at Cupertino at 10:08”.
Region monitoring and beacon monitoring are more stringent. When there is no full accuracy, the system will not deliver region entry, region exit or beacon related notifications to the App. The example of Reminders illustrates this difference: the function of reminding when leaving the office requires continuous accurate judgment of area boundaries, so it should direct the user to Settings to turn on full accuracy.
Key points:
- Functions that can be accomplished using approximate location should not force users to open Precise at startup.
- Functions that rely on region or beacon require full accuracy.
- Background functions that require long-term precise positioning are better suited to requesting users to turn on Precise permanently, rather than temporarily upgrading it.
Actively request only approximate location
(14:37) Some apps should not collect precise locations even if they have obtained full accuracy. Examples of TV Apps for presentations: Sports events, region locking, and local TV station matching require location, but usually only require a general area.
Core Location provides a newCLLocationAccuracyConstant that causes the location manager to request only reduced accuracy locations. The App can also be configured through Info.plist to request reduced accuracy by default when authorizing for the first time. In this way, the Precise: On switch will not appear in the system prompts, preventing users from accidentally giving higher precision.
Key points:
desiredAccuracyIt is mainly used to express the measurement accuracy required by the App, and also has power saving significance.- Reduced accuracy is a privacy authorization dimension. Users can clearly control how much location details the App gets.
- Reduced accuracy quantifies the real position into a region; the speech clearly states that it does not add random noise to the real coordinates.
- The quantified radius may be a few kilometers in urban areas, up to around 10 km in more sparse areas, with typical values around 5 km.
- The quantitative results will try to be consistent with the user’s intuition of “probably where I am”. For example, the vicinity of a cross-border border will fall on the side expected by the user.
watchOS, Always authorization, activityType, App Clips and Widgets
(19:57) The reduced accuracy API is available for iOS and watchOS. Paired iPhones and Apple Watches synchronize accuracy authorization just like traditional location authorization status. Watch connectivity can also share temporary authorization status and end-user status during this year, such as selecting Allow Once or temporary full accuracy upgrade on watch App, and phone App can benefit from this decision.
(21:14) After iOS 13.4, the Always authorization path becomes more certain. Apps that have obtained When In Use authorization can request Always when the function that requires Always is triggered, and allow users to consider it immediately in the context of the App. The talk clearly recommends: don’t request Always at the beginning, wait until the user gets to the functionality that really needs it.
(22:44)activityTypeAlso be careful with settings.airborneOnly suitable for real flying,fitnessOnly suitable for movements that the user explicitly starts,automotiveNavigationSuitable for vehicles determined to be driven on the road,otherNavigationSuitable for off-road, hiking, boating, walking and other mobile scenarios. Use other types only when no clear intent can be found.
(23:41) App Clips have two restrictions on Core Location: they cannot get Always authorization; the system displays While Using Until Tomorrow, and the authorization will be automatically cleared the next morning. Widgets cannot display location authorization prompts. Widgets that use location must be added to Info.plistNSWidgetWantsLocation, authorization comes from parent app.
Key points:
- The temporary authorization status of watchOS companion app will participate in synchronization.
- Always authorization should be triggered by specific functions.
- App Clips are not suitable for location features that require Always authorization.
- Widget requires parent app to be responsible for obtaining location authorization.
Core Takeaways
-
Make an approximate-first local recommendation page: First use reduced accuracy to give city-level content, such as nearby activities, weather, or regional rules. This way the default experience does not require precise coordinates. Entry implementation from check
accuracyAuthorizationInitially, users will only upgrade if they enter the routing, check-in, or exact match features. -
Add accuracy status prompt to map UI: When the user only authorizes the approximate location, use a large circle to express the range, and clearly indicate on the interface that the current state is reduced accuracy. Maps adopted this approach in his presentation. At the beginning, draw the two UI states of full and reduced, and then draw
locationManagerDidChangeAuthorizationReceive status refresh. -
Bind temporary precise positioning to a single task: Actions such as navigation, finding a car, and running starting point calibration are suitable for temporary full accuracy. Don’t make it a global pop-up window when the app starts. The implementation entrance is the task button, check before triggering
accuracyAuthorization, use purpose key to explain the reason when full accuracy is missing. -
Accuracy requirements for auditing background positioning functions: If the function relies on region entry, region exit or beacon, directly mark it as full accuracy requirement; if it only counts user visit time or general area, keep the reduced accuracy path first. This audit can reduce unnecessary Settings jumps.
-
Design independent location paths for App Clip and Widget: App Clip’s authorization will be cleared the next day, and Widget cannot activate the authorization on its own. App Clip only places short-term, foreground, interruptible location tasks; the Widget’s location description and authorization entry are placed back in the parent app.
Related Sessions
- Design for location privacy — Explain how approximate location should be fed back to users from the perspective of Maps interface design.
- Build trust through better privacy — Understand the high-level principles of iOS 14 privacy controls, including product background on approximate location.
- Handle the Limited Photos Library in your app — Compare the limited access of photo permissions to understand how iOS 14 allows users to grant only necessary data.
- Support local network privacy in your app — Moving on to another new permissions process in iOS 14 that requires clear purpose.
Comments
GitHub Issues · utterances