问题
My understanding since iOS 13 is that background location permissions can only be granted by the user after they have already granted foreground location permissions, and the app is in the background, when a location event which would have triggered the app's background location occurs. At that point they get a dialog something like:
Allow “App” to also access your location even when you are not using the app?
Every app I've used has the same behaviour, except one app, which is able to present that dialog immediately after asking for the foreground location permission dialog:
How does this app immediately and repeatedly trigger the background location dialog like this?
回答1:
If your app has asked for and received "when in use" authorisation it can then ask for "always" authorisation to trigger a second permission dialog. This behaviour requires iOS 13.4 or later.
You should consider the user experience. I suggest that your app explains why it needs always authorisation before asking for it, otherwise the user may be peppered with permission requests
来源:https://stackoverflow.com/questions/64534309/how-does-this-app-ask-for-background-location-permission-immediately