Post

Replies

Boosts

Views

Activity

Reply to iOS17 CLLocationUpdate Blue bar
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.
Oct ’24