Sian 发表于 2015-3-9 11:33:34

如何判断当前App是否允许使用系统定位功能

如题解答:利用CLLocationManager的一个类方法
+ (CLAuthorizationStatus)authorizationStatus
// CLAuthorizationStatus是一个枚举值:
typedef enum {
    kCLAuthorizationStatusNotDetermined = 0, // User has not yet made a choice with regards to this application
    kCLAuthorizationStatusRestricted,      // This application is not authorized to use location services.Due
                                             // to active restrictions on location services, the user cannot change
                                             // this status, and may not have personally denied authorization
    kCLAuthorizationStatusDenied,            // User has explicitly denied authorization for this application, or
                                             // location services are disabled in Settings
    kCLAuthorizationStatusAuthorized         // User has authorized this application to use location services
} CLAuthorizationStatus;所以,一切变得简单了    // 判断本地定位服务开启
    if( == kCLAuthorizationStatusDenied){
      // 提示用户开启定位服务,PS:iOS8系统会自动检测额
      ;
    }
页: [1]
查看完整版本: 如何判断当前App是否允许使用系统定位功能