‘authorizationStatus‘ is deprecated: first deprecated in iOS 14.0

简介: ‘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(!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;
}
目录
相关文章
|
6月前
|
Swift iOS开发
ITMS-90433: Invalid Swift Support
ITMS-90433: Invalid Swift Support
|
iOS开发 芯片 MacOS
[Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture...
[Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture...
432 0
|
Rust NoSQL 编译器
Rust在Visual Studio Code中调试提示debug type is not supported
Rust在Visual Studio Code中调试提示debug type is not supported
297 0
Rust在Visual Studio Code中调试提示debug type is not supported
|
API Python
全网首发:warning: #warning “Using deprecated NumPy API, disable it by “ “#defining NPY_NO_DEPRECATED_API
全网首发:warning: #warning “Using deprecated NumPy API, disable it by “ “#defining NPY_NO_DEPRECATED_API
277 0
|
JSON 前端开发 JavaScript
iOS Principle:Runtime(下)
iOS Principle:Runtime(下)
94 0
iOS Principle:Runtime(下)
|
缓存 编译器 Swift
iOS Principle:Runtime(中)
iOS Principle:Runtime(中)
169 0
iOS Principle:Runtime(中)
|
存储 缓存 编译器
iOS Principle:Runtime(上)
iOS Principle:Runtime(上)
112 0
iOS Principle:Runtime(上)
|
API Android开发
关于安卓api、implementation、compile的区别
关于依赖第三方库,有三种方式,分别是api、implementation、compile,在同一个module下面,这三种的作用都是一样的,但是在高版本的API中,使用compile会发现,compile被画上了横线,甚至编译不通过,说明在高版本中,compile已经被废弃了。也就是目前来说,只剩下api、implementation。
434 0
|
Android开发
【错误记录】Android Studio 编译报错 ( cannot open this project, please retry with version 4.2 or newer. )
【错误记录】Android Studio 编译报错 ( cannot open this project, please retry with version 4.2 or newer. )
351 0
【错误记录】Android Studio 编译报错 ( cannot open this project, please retry with version 4.2 or newer. )
|
存储 安全 网络协议
Basic debugging using logging for iOS apps
Basic debugging using logging for iOS apps
138 0
Basic debugging using logging for iOS apps