Closed ariofrio closed 6 years ago
Actually, this would apply to both .denied and .restricted, so "skipIfPreviouslyDenied" would be a misnomer.
Alternatives: "skipIfPreviouslyDeniedOrRestricted", "skipIfDeniedOrRestricted", "onlyIfNotDeterminedOrUpgrade".
Or the inverse: "ifDeniedOrRestricted"
Or two optional arguments: ifDenied and ifRestricted.
Never mind. I thought that apps were allowed to ask for permission after it has been denied, because the Apple Maps app can do that. When testing my own app, however, asking for permission more than once did nothing.
I will probably end up showing a message to the user asking them to change their settings and then redirecting them to the app settings page when this happens.
Yeah, the underlying API does not allow this. Apple must give themselves special permissions.
While many apps would do best not to ask for location permission after the user has denied it in the past, since they can make do without location information, some apps require location for features to work, so it makes sense to ask the user to provide permission when they try to use the feature again.
The way the API is defined, it doesn't allow the programmer to implement this functionality. It only asks for permission if permission has never been asked for in the past. If the user has denied it, then it will never ask for permission again.
See the lines:
and
A more flexible API would always ask for permission, and let the programmer check if the current status is .denied to skip asking for permission.
But I imagine changing the API in a backwards incompatible way would not be good. I propose adding a parameter to requestAuthorization "skipIfPreviouslyDenied" which defaults to true.