Instance Property


A Boolean value indicating whether the app should receive location updates when suspended.


var allowsBackgroundLocationUpdates: Bool { get set }


Apps that want to receive location updates when suspended must include the UIBackgroundModes key (with the location value) in their app’s Info.plist file and set the value of this property to true. The presence of the UIBackgroundModes key with the location value is required for background updates; you use this property to enable and disable background updates programmatically. For example, you might set this property to true only after the user enables features in your app where background updates are needed.

When the value of this property is false, apps receive location updates normally while running in either the foreground or background based on its current authorization. Updates stop only when the app is suspended, thereby preventing the app from being woken up to handle those events.

The default value of this property is false. Setting the value to true but omitting the UIBackgroundModes key and location value in your app’s Info.plist file is a programmer error.

See Also

Initiating Standard Location Updates

func startUpdatingLocation()

Starts the generation of updates that report the user’s current location.

func stopUpdatingLocation()

Stops the generation of location updates.

func requestLocation()

Requests the one-time delivery of the user’s current location.

var pausesLocationUpdatesAutomatically: Bool

A Boolean value indicating whether the location manager object may pause location updates.

var showsBackgroundLocationIndicator: Bool

A Boolean indicating whether the status bar changes its appearance when an app uses location services in the background.

var distanceFilter: CLLocationDistance

The minimum distance (measured in meters) a device must move horizontally before an update event is generated.

let CLLocationDistanceMax: CLLocationDistance

A constant indicating the maximum distance.

let kCLDistanceFilterNone: CLLocationDistance

A constant indicating that all movement should be reported.

var desiredAccuracy: CLLocationAccuracy

The accuracy of the location data.

var activityType: CLActivityType

The type of user activity associated with the location updates.

enum CLActivityType

Constants indicating the type of activity associated with location updates.