首页 > 代码库 > 判断当前有无给应用授权定位功能

判断当前有无给应用授权定位功能

if ([CLLocationManager locationServicesEnabled] && ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)) {
        
        //定位功能可用
        NSLog(@"定位功能可用");
        
    } else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
        
        //定位不能用
        NSLog(@"定位功能不可用");
    }

 

判断当前有无给应用授权定位功能