Starts the generation of updates based on significant location changes.
- iOS 4.0+
- macOS 10.7+
This method initiates the delivery of location events asynchronously, returning shortly after you call it. Location events are delivered to your delegate’s
location method. The first event to be delivered is usually the most recently cached location event (if any) but may be a newer event in some circumstances. Obtaining a current location fix may take several additional seconds, so be sure to check the timestamps on the location events in your delegate method.
After returning a current location fix, the receiver generates update events only when a significant change in the user’s location is detected. It does not rely on the value in the
distance property to generate events. Calling this method several times in succession does not automatically result in new events being generated. Calling
stop in between, however, does cause a new initial event to be sent the next time you call this method.
If you start this service and your app is subsequently terminated, the system automatically relaunches the app into the background if a new event arrives. In such a case, the options dictionary passed to the
application(_: methods of your app delegate contains the key
location to indicate that your app was launched because of a location event. Upon relaunch, you must still configure a location manager object and call this method to continue receiving location events. When you restart location services, the current event is delivered to your delegate immediately. In addition, the
location property of your location manager object is populated with the most recent location object even before you start location services.
In addition to your delegate object implementing the
location method, it should also implement the
location method to respond to potential errors.