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; NO if they are not.

Discussion

The user can enable or disable location services from the Settings app by toggling the Location Services switch in General.

You should check the return value of this method before starting location updates to determine whether the user has location services enabled for the current device. Location services prompts users the first time they attempt to use location-related information in an app but does not prompt for subsequent attempts. If the user denies the use of location services and you attempt to start location updates anyway, the location manager reports an error to its delegate.

See Also

Determining the Availability of Services

+ authorizationStatus

Returns the app’s authorization status for using location services.

+ deferredLocationUpdatesAvailable

Returns a Boolean value indicating whether the device supports deferred location updates.

Deprecated
+ significantLocationChangeMonitoringAvailable

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

+ 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 Bluetooth beacons.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software