1. Call Cllocationmanager's Authorizationstatus method to get the app's current location authorization status:
Clauthorizationstatus status = [Cllocationmanager authorizationstatus];
2. Authorization Status callback processing:
User Authorization Status:
kclauthorizationstatusnotdetermined |
User has not made a decision whether to enable location services |
kclauthorizationstatusrestricted |
The user is not authorized to use location services and may not be authorized by the user to disable access |
Kclauthorizationstatusdenied |
The user has explicitly banned the app from using location services or the current system location service is turned off |
Kclauthorizationstatusauthorizedalways |
App authorization can always use location services even if the app is not in use |
Kclauthorizationstatusauthorizedwheninuse |
Allow access to location services during use of this app |
if (Status = = kclauthorizationstatusnotdetermined) {// Authorization status processing }Else if (Status = = kclauthorizationstatusrestricted) {// Authorization status processing }Else if (status = = Kclauthorizationstatusauthorizedalways | | status = = Kclauthorizationstatusauthorizedwheninuse) { // Authorization status Processing }
IOS Get app Current location authorization status