Protocol

CLLocationManagerDelegate

The CLLocationManagerDelegate protocol defines the methods used to receive location and heading updates from a CLLocationManager object.

Overview

Upon receiving a successful location or heading update, you can use the result to update your user interface or perform other actions. If the location or heading could not be determined, you might want to stop updates for a short period of time and try again later. You can use the stopUpdatingLocation(), stopMonitoringSignificantLocationChanges(), stopUpdatingHeading(), stopMonitoring(for:), or stopMonitoringVisits() methods of CLLocationManager to stop the various location services.

The methods of your delegate object are called from the thread in which you started the corresponding location services. That thread must itself have an active run loop, like the one found in your application’s main thread.

Symbols

Responding to Location Events

func locationManager(CLLocationManager, didUpdateLocations: [CLLocation])

Tells the delegate that new location data is available.

func locationManager(CLLocationManager, didFailWithError: Error)

Tells the delegate that the location manager was unable to retrieve a location value.

func locationManager(CLLocationManager, didFinishDeferredUpdatesWithError: Error?)

Tells the delegate that updates will no longer be deferred.

func locationManager(CLLocationManager, didUpdateTo: CLLocation, from: CLLocation)

Tells the delegate that a new location value is available.

Pausing Location Updates

func locationManagerDidPauseLocationUpdates(CLLocationManager)

Tells the delegate that location updates were paused.

func locationManagerDidResumeLocationUpdates(CLLocationManager)

Tells the delegate that the delivery of location updates has resumed.

Responding to Heading Events

func locationManager(CLLocationManager, didUpdateHeading: CLHeading)

Tells the delegate that the location manager received updated heading information.

func locationManagerShouldDisplayHeadingCalibration(CLLocationManager)

Asks the delegate whether the heading calibration alert should be displayed.

Responding to Region Events

func locationManager(CLLocationManager, didEnterRegion: CLRegion)

Tells the delegate that the user entered the specified region.

func locationManager(CLLocationManager, didExitRegion: CLRegion)

Tells the delegate that the user left the specified region.

func locationManager(CLLocationManager, didDetermineState: CLRegionState, for: CLRegion)

Tells the delegate about the state of the specified region.

func locationManager(CLLocationManager, didStartMonitoringFor: CLRegion)

Tells the delegate that a new region is being monitored.

Responding to Ranging Events

func locationManager(CLLocationManager, rangingBeaconsDidFailFor: CLBeaconRegion, withError: Error)

Tells the delegate that an error occurred while gathering ranging information for a set of beacons.

Responding to Visit Events

func locationManager(CLLocationManager, didVisit: CLVisit)

Tells the delegate that a new visit-related event was received.

Responding to Authorization Changes

func locationManager(CLLocationManager, didChangeAuthorization: CLAuthorizationStatus)

Tells the delegate that the authorization status for the application changed.

Relationships

Inherits From