CLServiceSession: how to check the diagnostics (authorisation status and accuracy authorisation) without prompting the user about location services (delay the prompt)?

Hello,

I'm currently refactoring my app to use the new Core Location APIs introduced in iOS 17 (CLLocationUpdate) and iOS 18 (CLServiceSession). I'm not quite sure how best to reproduce the current flow I've in my app right now:

  • At app launch:

    • If location services are authorized when in use + full accuracy: get the user current location then stop.
    • If the services are not yet determined or denied, do nothing.
  • Later in the app, when a user taps on a button to get its current location:

    • Not determined: prompt and get the user current location if authorised when in use with full accuracy, then stop.
    • Denied: present an alert (open Settings).
    • Authorised when in use
      • Full accuracy: get the user current location then stop.
      • Not full accuracy: present an alert (open Settings).

My issue is that I can't find a way to determine the authorisation status without prompting the user. As soon as I create a CLServiceSession to inspect the diagnostics (CLServiceSession.Diagnostic), the user is prompted. So I can't use this at app launch as I want to delay the prompt until the user first interacts with the feature actually requiring location services.

Do I still need to use CLLocationManager().authorizationStatus and CLLocationManager().accuracyAuthorization at app launch?

Or am I missing something in the new APIs that allow me to check a session status without prompting?

Thank you!

I stumbled upon this article (Suspending authorization requests) but unfortunately it doesn't cover my "get authorisation status and accuracy authorisation at app launch without prompting the user" use case.

CLServiceSession: how to check the diagnostics (authorisation status and accuracy authorisation) without prompting the user about location services (delay the prompt)?
 
 
Q