简体   繁体   中英

iOS 13 check for provisional authorization status of CLLocationManager

As per the WWDC video, https://developer.apple.com/videos/play/wwdc2019/705/ , when you ask for " AlwaysAuthorization " permission you will see only " When In Use, Once and Don't allow" . Even if you tap on " When In Use ", the delegate call back will come back as kCLAuthorizationStatusAuthorizedAlways . This is working as expected. But is there a way to find out that the request is still provisional or actually-always-allow?

There is no enum associated to this permission. The only allowed enums are:

kCLAuthorizationStatusNotDetermined, kCLAuthorizationStatusDenied, kCLAuthorizationStatusAuthorizedAlways, kCLAuthorizationStatusAuthorizedWhenInUse

Because I want to show an alert as soon as user grants the " While In Use " permission, to tell them that the app will only work if you provide " Always Allow " via system preferences and I can navigate them to the system settings page of my app via a tap, just like how Zenly is doing it: https://www.macrumors.com/2019/08/16/app-developers-tracking-restrictions-ios-13/

You can check if you're getting location updates in the background for more than 10 seconds after the application gets in the background. If yes, then you have the permanent Allow Always . If not, then you have the provisional Allow Always (or any other authorization that you can check explicitly).

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