You can determine your authorization status using the authorizationStatus
class method on the CLLocationManager
. This returns a CLAuthorizationStatus
, which is defined as:
typedef enum { kCLAuthorizationStatusNotDetermined = 0, kCLAuthorizationStatusRestricted, kCLAuthorizationStatusDenied, kCLAuthorizationStatusAuthorized } CLAuthorizationStatus;
The system will prompt the user to authorize your application if the authorization status is not defined when trying to start the location manager.
In addition, you can check the method of the locationServicesEnabled
class to determine if location is enabled on the system.
Mark adams
source share