![](/img/trans.png)
[英]requestWhenInUseAuthorization and requestAlwaysAuthorization
[英]requestAlwaysAuthorization after requestWhenInUseAuthorization is accepted
我的應用程序可以具有兩級LocationHandler狀態。 首先,我啟動requestWhenInUseAuthorization
然后,如果用戶激活某些特定功能,我啟動requestAlwaysAuthorization
。
如果用戶拒絕requestAlwaysAuthorization讓我知道該功能將無法按預期工作,我需要收到通知。 問題是,在這種情況下,不會調用didChangeAuthorizationStatus
因為授權狀態保持不變(它是AuthorizedWhenInUse
,它仍然是AuthorizedWhenInUse
)。
如果用戶在接受AuthorizedWhenInUse后拒絕授權,您是否知道如何通知我?
從iOS 10開始,即使用戶在使用中接受,也不再可能在調用requestWhenInUseAuthorization()之后調用requestAlwaysAuthorization()。
在先前版本(至少iOS8)中,您可以“升級”授權並在用戶接受使用后請求始終授權。 這已經不可能了。
最好的辦法是偶爾檢查CLLocationManager.authorizationStatus()並顯示一個對話框,使用UIApplicationOpenSettingsURLString將用戶指向正確的設置頁面
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.