|
I am surprised no top comment mentions this — on iOS, you cannot distinguish if you were granted a permission or not. As an example, if an app asks you for access to your photos, it will always get an array. The trick is that when you deny this permission, the array will be empty, so you cannot know if the user simply has an empty library or if he denied you access. I like it, simple and elegant. Naturally, in the case of photos, you can use a heuristic, because basically everyone will have at least some pictures. However, in the case of other types of data, say, health data, it is not so clearcut. |
This isn’t correct. For instance, accessing location services provides CLAuthorizationStatus:
https://developer.apple.com/documentation/corelocation/claut...
…and push notifications have UNAuthorizationStatus:
https://developer.apple.com/documentation/usernotifications/...
…and health data has HKAuthorizationStatus:
https://developer.apple.com/documentation/healthkit/hkauthor...
…and contacts has CNAuthorizationStatus:
https://developer.apple.com/documentation/contacts/cnauthori...
…and photos has PHAuthorizationStatus:
https://developer.apple.com/documentation/photokit/phauthori...
Photos is a special case because the user has the option of denying access, giving limited access, or giving full access. You can determine if the user has denied access, but you cannot distinguish between limited access and full access.