Contents

locationServicesEnabled()

Returns a Boolean value indicating whether location services are enabled on the device.

Declaration

class func locationServicesEnabled() -> Bool

Return Value

true if location services are enabled on the device; false if they are not.

Discussion

Users can enable or disable location services by toggling the Location Services switch in Settings > Privacy.

You are not required to call locationServicesEnabled(). However, If you wish to display instructions about enabling location services, you may check the return value of this method to find out if the services are disabled for the entire device, or just for your app. If the result is true, provide instructions for enabling services for your app; otherwise, provide instructions for enabling the Location Services switch in Settings > Privacy.

If users disable or deny location services and you attempt to start location updates anyway, the location manager reports an error to its delegate. See locationManager(_:didFailWithError:) and locationManager(_:monitoringDidFailFor:withError:) for more information.

Topics

Related Documentation

See Also

Determining the availability of services