简体   繁体   中英

Retrieve Authorization Status for Core Location

Apple has deprecated the authorizationStatus method. Is there a way to know which is the status of the authorisation for my App? Let's say that a user granted the permission in a previous session and with another app session I wanted to show or hide a button depending on the fact that the user has granted the permission or not. How can I get this information now that authorizationStatus is no longer available?

您应该使用locationManagerDidChangeAuthorization委托。

see documentation: CLLocationManager :

class func authorizationStatus() -> CLAuthorizationStatus is deprecated.

there are new instance property that available since iOS 14

var authorizationStatus: CLAuthorizationStatus - The current authorization status for the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM