Take advantage of background execution modes to respond to location-related events at any time.
- Core Location
Most location services are meant to be used while your app is in the foreground, but some can also run in the background or even cause your app to be launched. To receive events in the background, configure the Location updates capability for your app in Xcode, as shown in Figure 1. You must also set the
allows property of your
CLLocation object to
When the system launches your app, use the launch options dictionary passed to the
application(_: methods to determine whether your app was launched to handle a location update. This dictionary contains the
location key when the app is launched because of location services. Create a new
CLLocation object, configure it with a delegate, and start location services again to receive the update.
Table 1 lists the services that launch your app to report new location updates. Services that cause an app to be relaunched do so even after the user force-quits the app
Standard location service
Significant-change location service