‘authorizationStatus‘ is deprecated: first deprecated in iOS 14.0

‘authorizationStatus’ is deprecated: first deprecated in iOS 14.0
Replace ‘authorizationStatus’ with ‘authorizationStatus’
我们的app系统最低支持ios14.0
出问题的代码:

- (BOOL)isUserOpenLocationFunction
{
    CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
    if (status == kCLAuthorizationStatusNotDetermined || status == kCLAuthorizationStatusRestricted || status == kCLAuthorizationStatusDenied) {
        return NO;
    }
    return YES;
}

修改后的代码:

- (BOOL)isUserOpenLocationFunction
{
    if([CLLocationManager locationServicesEnabled])
    {
        return NO;
    }
    if(!self.manager)
    {
        self.manager = [[CLLocationManager alloc] init];
        self.manager.delegate = self;
    }

    CLAuthorizationStatus status = self.manager.authorizationStatus;//ios 14及之前后使用 [CLLocationManager locationServicesEnabled]; ios 14及之前使用
    if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse) {
        return YES;
    }
    return NO;
}

你可能感兴趣的:(iOS系统适配,Object,C,定位,ios,objective-c)