What makes provisional Always authorization provisional?

前端 未结 1 939
感情败类
感情败类 2021-01-21 23:47

According to Apple, if you ask for your Core Location app to get Always authorization when the authorization is "not determined", the user sees the dialog for When In

相关标签:
1条回答
  • 2021-01-22 00:36

    In WWDC 2019's What's New in Core Location, they outline the basic process in iOS 13.0:

    1. Your app requests “always” permission.

    2. The user sees “when in use” permissions alert, not an “always” permission alert:

    3. If the user grants “when in use” the app is in “provisional always” state.

      In this case, and somewhat confusingly, the authorizationStatus will return .authorizedAlways when you are in this “provisional always” state and the Settings app on the phone will suggest it’s in “when in use” state. But in reality, it’s in this “provisional always” state, not quite what one might infer from authorizationStatus nor from what you see in the Settings app.

      Needless to say, if the user doesn't even grant “when in use” (e.g. they deny or chose “only once”), then obviously you won’t be in “provisional always” state.

    4. It remains in this provisional state until, as the video says, you “start using ‘always’ powers”. For example, if you start significant change service and move a distance sufficient to trigger a significant change.

      When the app does “start using ‘always’ powers”, the OS will ask the user if they are is willing to upgrade “when in use” to “always”. (It won't always happen immediately, but will wait until the user is not busy doing other things, to reduce the risk that they'll dismiss the alert just to get back to what they were doing.)

    So, it’s not a question of “reverting” to some other state. The app will remain in this “provisional always” state until there is final “agreement” (where the user sees the second alert and either agrees to upgrade to .authorizedAlways or denies and it is set to .authorizedWhenInUse).


    I know you know this, but for the sake of future readers:

    In WWDC 2020 video What's new in location, they describe a change introduced in iOS 13.4. Instead of the flow above (where you ask for “always”, the user sees “when in use” permissions, and they don’t see the “upgrade to always” until “always” services are actually triggered), iOS 13.4 introduced a new flow, where you can ask for “when in use” (rather than “always”) and assuming the user granted it, you can ask for “always” later, where appropriate in the app, and the user get the second alert (this time asking if the user would like to upgrade to “always” or not). You just need the appropriate permissions strings.

    0 讨论(0)
提交回复
热议问题