On iOS 13, there doesn't appear to be a way to determine when the phone's location permission state as Allow Once. When calling check(PERMISSIONS.IOS.LOCATION_WHEN_IN_USE);, the result is granted, but there doesn't appear to be a way to determine a difference between the location permissions _actually_ being in the WHEN_IN_USE state and the Allow Once state.
In my particular use case, I am trying to show the user's current location permissions from within the app, instead of forcing them to go to the phone's privacy settings to see this. However, i cannot reliably determine the difference between the Allow Once state and WHEN_IN_USE.
Perhaps if there was a way to check when WHEN_IN_USE is granted, can I also resurface the location permissions prompt? If the user actually selected 'Allow While Using App' instead of Allow Once, the app should no longer be able to resurface the permissions prompt. But if they selected Allow Once, then they should be able to resurface the prompt, and that could reliably differentiate between the two states.
Hi @zacharyweidenbach. It's impossible to know if the user chose Allow Once because this state does not really exists in permission results.
See https://zonneveld.dev/ios-13-prepare-your-app-for-the-allow-once-location-permission/ and https://developer.apple.com/documentation/corelocation/clauthorizationstatus?language=objc for more details.
When the user choose ‘Allow Once’, the CLAuthorizationStatus is set to authorizedWhenInUse. When the app will run again, the CLAuthorizationStatus is put back to notDetermined, which means you are able to ask for location permission again.
Which are mapped to RESULTS.GRANTED (when requesting PERMISSIONS.IOS.LOCATION_WHEN_IN_USE) and RESULTS.DENIED (when checking PERMISSIONS.IOS.LOCATION_WHEN_IN_USE after restarting the app)
Most helpful comment
Hi @zacharyweidenbach. It's impossible to know if the user chose
Allow Oncebecause this state does not really exists in permission results.See https://zonneveld.dev/ios-13-prepare-your-app-for-the-allow-once-location-permission/ and https://developer.apple.com/documentation/corelocation/clauthorizationstatus?language=objc for more details.
Which are mapped to
RESULTS.GRANTED(when requestingPERMISSIONS.IOS.LOCATION_WHEN_IN_USE) andRESULTS.DENIED(when checkingPERMISSIONS.IOS.LOCATION_WHEN_IN_USEafter restarting the app)