Type Method

locationServicesEnabled

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

Declaration

+ (BOOL)locationServicesEnabled;

Return Value

YES if location services are enabled on the device; NO 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:monitoringDidFailForRegion:withError: for more information.

See Also

Determining the Availability of Services

+ significantLocationChangeMonitoringAvailable

Returns a Boolean value indicating whether the significant-change location service is available on the device.

+ headingAvailable

Returns a Boolean value indicating whether the location manager is able to generate heading-related events.

+ isMonitoringAvailableForClass:

Returns a Boolean value indicating whether the device supports region monitoring using the specified class.

+ isRangingAvailable

Returns a Boolean value indicating whether the device supports ranging of beacons that use the iBeacon protocol.