Expected behavior of CLServiceSessions(.always) after device restart?

Hi! I was wondering what the expected behavior of CLServiceSession(authorization: .always) after a device restart was?

What I am observing right now is that, after a device restart, location access from the background is denied until the app enters the foreground for the first time (CLServiceSession.Diagnostic says insufficientlyInUse: true; CLLocationUpdate additionally says serviceSessionRequired: true).

Is this the expected behavior?

If it is, then this seems like a somewhat suboptimal user experience to me, at least for my use case - the user's intention regarding the background location access won't have changed just because the device was rebooted.

(In case this is relevant, my use case is transmitting the current location to connected Bluetooth devices, e.g. digital cameras. As such my app is setting UIBackgroundModes of ["bluetooth-central”]).

Answered by TimNN in 800304022

This seems to have been fixed by iOS 18 Beta 6.

Expected behavior for an .always session is to continue receiving updates in the background. So, your experience could be due to a bug in the beta builds.

Our engineering teams need to investigate this issue, as this might indicate an issue with iOS 18 Beta.

We'd greatly appreciate it if you could open a bug report, include crash logs and sample code or models that reproduce the issue, and post the FB number here once you do.

It would be very helpful if you could please go to https://developer.apple.com/bug-reporting/profiles-and-logs/ and follow the instructions for Location Services for iOS to install a logging profile on your device. Then reproduce the issue, and follow the instructions at the above link to create a sysdiagnose. And attach that to the Feedback report as well.

Bug Reporting: How and Why? has tips on creating a successful bug report.


Argun Tekant /  DTS Engineer / Core Technologies

The feedback report is FB14381484 (I actually created that before the initial forum post).

I have added an update with a sysdiagnose with the Location Services debug profile active, and included relevant timestamps in the report.

I don't have shareable sample code at the moment.

Accepted Answer

This seems to have been fixed by iOS 18 Beta 6.

Expected behavior of CLServiceSessions(.always) after device restart?
 
 
Q