I have an app that uses a combination of startMonitoringForRegion:
and startMonitoringSignificantLocationChanges
to keep aware of where the user is when the app is in the background. Does this mean that I need to include the location
value for the UIBackgroundModes
key in the Info.plist
?
This is a quote from the docs:
The significant-change location service is highly recommended for apps that do not need high-precision location data. With this service, location updates are generated only when the user’s location changes significantly; thus, it is ideal for social apps or apps that provide the user with noncritical, location-relevant information. If the app is suspended when an update occurs, the system wakes it up in the background to handle the update. If the app starts this service and is then terminated, the system relaunches the app automatically when a new location becomes available. This service is available in iOS 4 and later, and it is available only on devices that contain a cellular radio.
...
An app that provides continuous location updates to the user (even when in the background) can enable background location services by including the UIBackgroundModes key (with the location value) in its Info.plist file. The inclusion of this value in the UIBackgroundModes key does not preclude the system from suspending the app, but it does tell the system that it should wake up the app whenever there is new location data to deliver. Thus, this key effectively lets the app run in the background to process location updates whenever they occur.
My interpretation of this is that the location
value for the UIBackgroundModes
key is only required if the app needs continuous location updates, like a sat nav app.
I have also tried running the app on a device without the location
value for the UIBackgroundModes
key and it continues to report significant location changes and when the a region is entered of exited.
Also, the only place that UIBackgroundModes
is mentioned in the CLLocationManager Class Reference is in the startUpdatingLocation
discussion, which I am not using.