What's New in Core Location

Description: Location technologies are core to delivering context-based services within your app. Discover how the latest features in the Core Location Framework lay the groundwork for advanced ranging capabilities and delivers more options for you to clearly communicate your location needs to your users, and allow them to provide more granular access authorization to your app.

iOS 13 Authorization Flow

New authorization flow for core location: If the user presses not allow, that’s it (as before).

If we request Always On authorization, locationManager.requestAlwaysAuthorization(), in iOS 13 the user gets this:

Therefore, regardless if we ask for when in use “only” or always, this is the pop up that the user will get.

However, if:

  • The app has asked for Always On
  • The user has granted the most prominent option (Allow While in Use, as seen in the screenshot above)

At this point iOS will grant a provisional “Always On” authorization to our app, even when the user has tapped Allow While in Use.

At this point the app can act as if the real Always On authorization has been granted.

When something happens that would require the Always On authorization, then and only then iOS will request for that Always Allow authorization in the app behalf:

Then, and only then, both the app and the user will be on the same page.

New in iOS 13

All core location APIs are available as long as any authorization is granted.

From now on, the difference between “When In Use” and “Always” is that things can be started when the app is not in use if the “Allow Always” authorization has been granted.

When is the app in use?

  • When the app is in the foreground and for a few seconds after it has been put in the background (grace period).
  • If we set to true the location manager property allowsBackgroundLocationUpdates, our app will be considered in use even after the app has been put in the background, and the blue status bar indicator will appear.
  • Watch complications are considered always in use.

Therefore, from iOS 13, even apps with only “When In Use” authorization can do background tracking.

Allow Once

In iOS 13 ww also have a temporary Allow Once authorization:
from the app point of view, this will become a “When In Use” grant until the app is no longer in use, after which the authorization will go back to the “not determined” status. After which the app can once again ask for authorization.

Missing anything? Corrections? Contributions are welcome 😃

Related

Written by

Federico Zanetello

Federico Zanetello

Software engineer with a strong passion for well-written code, thought-out composable architectures, automation, tests, and more.