I'm using CoreLocation
framework in my app in Xcode7(pre-released),and I noticed that there is a newly added property called allowsBackgroundLocationUpdates
in CLLocationManager
class.
What's the relationship between this property and the location updates in the Background Modes of the Capabilities tab. What's the default value of it and does it affect apps running in iOS9?
This new property is explained in the WWDC session "What's New in Core Location".
The default value is
NO
if you link against iOS 9.If your app uses location in the background (without showing the blue status bar) you have to set
allowsBackgroundLocationUpdates
toYES
in addition to setting the background mode capability in Info.plist. Otherwise location updates are only delivered in foreground. The advantage is that you can now have location managers with background location updates and other location managers with only foreground location updates in the same app. You can also reset the value toNO
to change the behavior.The documentation is pretty clear about it: