Unreliable CLServiceSession(authorization: .always) when using other background modes.

I am using CLServiceSession(authorization: .always) to start a service session for tracking Zone entry and exit in the background in my app. It has been working fine on iOS 18 until recently when we added some BGProcessingTasks.

The task runs when the user is not moving and the device is on charge, this task runs fro a bit in the background, however we are seeing that even though we are reinitializing then session upon app launch.
We have even tried to just explicitly reinitialize a session within the background task callback, but the zone tracking still continues to fail. Significant location changes are unaffected.

Timeline of events:

  1. User Opens App,
  2. CLServiceSession(authorization: .always) is called (assume permissions have already been granted.)
  3. App is backgrounded
  4. User moves outside zone and app captures the data correctly (this can happen any amount of times)
  5. User plugs in Phone
  6. BGProcessingTask callback is run, it may or may not be terminated early. The service session is recreated as the first action in the callback. (we have also tried putting it in the main init() function for the app, same outcome)
  7. User moves outside zone later and app does NOT capture the data.
  8. User is sad :(

The session seems to be reinitialized correctly when the app is launched due to CoreLocation updates.

Is this expected behaviour or a bug? Is there a good way to debug what is happening with the sessions?

Unfortunately, the WWDC sessions on this have not enlightened us about the cause of this behaviour.

Unreliable CLServiceSession(authorization: .always) when using other background modes.
 
 
Q