iOS17 CLLocationUpdate Blue bar

I am using CLLocationUpdate.liveUpdates() and CLBackgroundActivitySession to receive background location updates. My app has "Always" authorization, but I can not get rid of the top left "Blue bar" in any way except for by manually closing the app (swipe up in multi-app preview view). I have tried setting CLLocationManager.showsBackgroundLocationIndicator = false but it does not make any difference.

How can I get rid of the blue bar in the top left corner?

  • My project started from this WWDC23 sample code
  • Has "always" location authorisation through CLLocationManager.requestAlwaysAuthorization()
  • Has UIBackgroundModes - location set in Info.plist
  • Tested multiple days with a real iPhone 14, iOS 17.2 (although an iPhone SE gen2 iOS 17.2 seems to loose the blue bar after a while)

I am also using a CLBackgroundActivitySession

I'm having the same problem.

I ditched this approach completely and went with a solution that uses scheduled push notifications to get location updates

CLLocationUpdate.liveUpdates() and CLBackgroundActivitySession may cause memory leaks. For example:

var updates: CLLocationUpdate? = CLLocationUpdate.liveUpdates()
// updates = nil
updates = CLLocationUpdate.liveUpdates()

var session = CLBackgroundActivitySession()
// session.invalidate(), session = nil
session = CLBackgroundActivitySession()

If you overwrite the variable without explicitly breaking the reference after assigning the value to the variable, a memory leak will occur.

Check this with the same code using Instruments - Leaks.

If CLBackgroundActivitySession or CLLocationUpdate.liveUpdates stay in memory due to the memory leak, even in the background, the blue bar indicating that location data is being collected will not disappear.