We frequently report things to Apple, and sometimes they actually act upon it. Exactly to prevent the blue bar from appearing shortly as described in the question, Apple has introduced a new property on CLLocationManager
in iOS-9. Set it at the moment you know you will need the location in the background:
theLocationManager.allowsBackgroundLocationUpdates = YES;
or, in a backward compatible way:
if ([theLocationManager respondsToSelector:@selector(setAllowsBackgroundLocationUpdates:)]) {
[theLocationManager setAllowsBackgroundLocationUpdates:YES];
}
in Swift:
if #available(iOS 9.0, *) {
theLocationManager.allowsBackgroundLocationUpdates = true
}
If this property is not set, then the Blue Bar will not appear when exiting the app, and the user location is not available to your app.
Note that in iOS 9, you must set the property in order to be able to use location in the background.
See the WWDC video for Apple’s explanation.