Determining if user has denied CoreLocation permission

£可爱£侵袭症+ 提交于 2019-11-30 09:50:21

You can determine your authorization status using the authorizationStatus class method on 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 undetermined when you attempt to start the location manager.

Additionally, you can check the locationServicesEnabled class method to determine if location is enabled system wide.

Additionally - If locationServicesEnabled returns NO and you attempt to start location services anyway, the system will prompt the user to confirm whether location services should be reenabled.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!