Clarification on the correct use for CLServiceSession

While updating my app for iOS 18 I have run into some major issues with how CLMonitor and visit tracking are handled in the background. I have implemented the new CLServiceSession (i think) correctly. In my @main App struct's init method I call CLServiceSession(authorization: .always) to create a session. This is done in the foreground when the app is launched and also in the background. From what i understand this is the intended way to create a session as when the app is relaunched by the system the existing session is terminated a few moments later.

What im seeing in iOS 18 vs iOS 17 is drastically less location updates being delivered to the app. i see around the same significant updates being delivered (around 1 per mile - 5 miles) but the CLMonitor.CircularGeographicConditions are being triggered at about 1 per 1 to 2 minutes regardless of the radius. When a zone is left the condition is removed in the background and a new condition is created at the next place it should be tracking. For visit tracking, it only reports a visit correctly about 10% of the time. my guess is the app is getting suspended and/or terminated and the CLServiceSession isn't correctly being reinitialized (or something completely different, i'm really not sure at this point)

I would love some guidance as to the correct way to handle these updates in iOS 18. It is unclear if these are intentional limitations imposed in iOS 18, incorrect implementation on my part, or a bug in the betas.

Note: startUpdatingLocation is not appropriate for this app as it is way too power hungry.

Answered by DTS Engineer in 791471022

The fact that you are getting any location updates at all, and significant location updates are coming same as before indicates that your CLServiceSession is likely configured correctly.

For your region updates, you say you get about 1 per 1-2 minutes. This has always been the case and not new to iOS 18. Indeed we have always said to expect 1 update every 3-5 minutes.

Also, I wonder if your regions are appropriately large. If you are getting significant location updates every 5 miles, that means you are in an area where the mobile/wifi based signal coverage (which these services depend on) is only adequate for that kind of accuracy. If your region radii are smaller than what the horizontalAccuracy the significant location updates provide, you may actually miss the entry or exit events to those smaller regions.

All this is mostly the same on iOS 18 as it was before in the old API. Some of the differences you are seeing could be coincidental.

Accepted Answer

The fact that you are getting any location updates at all, and significant location updates are coming same as before indicates that your CLServiceSession is likely configured correctly.

For your region updates, you say you get about 1 per 1-2 minutes. This has always been the case and not new to iOS 18. Indeed we have always said to expect 1 update every 3-5 minutes.

Also, I wonder if your regions are appropriately large. If you are getting significant location updates every 5 miles, that means you are in an area where the mobile/wifi based signal coverage (which these services depend on) is only adequate for that kind of accuracy. If your region radii are smaller than what the horizontalAccuracy the significant location updates provide, you may actually miss the entry or exit events to those smaller regions.

All this is mostly the same on iOS 18 as it was before in the old API. Some of the differences you are seeing could be coincidental.

Thanks for the heads up about the horizontal accuracy, after some more testing that was definitely the issue. Strangely the iPads we are testing on seem to have terrible accuracy in the beta. I'll submit feedback, but it could just be coincidental.

Clarification on the correct use for CLServiceSession
 
 
Q