‘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;
}
目录
相关文章
|
8月前
|
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...
165 0
Xcode12适配The linked library is missing one or more architectures required by thi
升级到Xcode12后,运行Release模式后,会提示以下信息
169 0
|
Rust NoSQL 编译器
Rust在Visual Studio Code中调试提示debug type is not supported
Rust在Visual Studio Code中调试提示debug type is not supported
253 0
Rust在Visual Studio Code中调试提示debug type is not supported
|
缓存 编译器 Swift
iOS Principle:Runtime(中)
iOS Principle:Runtime(中)
151 0
iOS Principle:Runtime(中)
|
JSON 前端开发 JavaScript
iOS Principle:Runtime(下)
iOS Principle:Runtime(下)
75 0
iOS Principle:Runtime(下)
|
存储 缓存 编译器
iOS Principle:Runtime(上)
iOS Principle:Runtime(上)
97 0
iOS Principle:Runtime(上)
|
iOS开发
was built for newer iOS version (8.2) than being linked (8.0) 解决办法
was built for newer iOS version (8.2) than being linked (8.0) 解决办法
536 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. )
326 0
【错误记录】Android Studio 编译报错 ( cannot open this project, please retry with version 4.2 or newer. )
|
存储 安全 前端开发
These are some of the existing methods to implement IPC on iOS
These are some of the existing methods to implement IPC on iOS
163 0
These are some of the existing methods to implement IPC on iOS
|
存储 安全 网络协议
Basic debugging using logging for iOS apps
Basic debugging using logging for iOS apps
117 0
Basic debugging using logging for iOS apps