Core Location in iOS 8
iOS 8 continues that inexorable march of progress. Like many other aspects of the latest update, Core Location has been shaken up, with changes designed both to enable developers to build new kinds of things they couldn’t before and to help maintain user privacy. Specifically, iOS 8 brings three major sets of changes to the Core Location framework: more granular permissions, indoor positioning, and visit monitoring.
→ nshipster.com/core-location-in-ios-8/
iOS 8 introduces significant updates to the Core Location framework, enhancing developer capabilities and user privacy through granular permissions, indoor positioning, and visit monitoring.
The new permissions model splits location access into "When In Use" and "Always" authorization, requiring explicit requests via requestWhenInUseAuthorization()
or requestAlwaysAuthorization()
, with mandatory NSLocationWhenInUseUsageDescription
or NSLocationAlwaysUsageDescription
keys in Info.plist
to explain usage, fostering trust by limiting data access.
The locationManager:didChangeAuthorizationStatus:
delegate method handles asynchronous permission changes, ensuring a unified code path for starting location updates, with backwards compatibility for iOS 7 using conditional checks.
Indoor positioning, supported by CLFloor
, enables floor-level tracking in large venues using WiFi, GPS, cellular, and iBeacon data, though access is restricted to approved businesses via Apple Maps Connect.
CLVisit
introduces background monitoring for user visits, delivering CLVisit
objects with coordinates, accuracy, and arrival/departure times, activated by startMonitoringVisits()
with "Always" authorization, but its precision in iOS 8.1 is limited, necessitating caution for critical applications.
Swift’s clear syntax and safety features streamline these implementations, making Core Location a powerful tool for location-aware apps while prioritising user privacy.
Category:
Tag:
Year: