Search code examples
ioscloudkit

Is it worth to check with statusForApplicationPermission or enough to call requestApplicationPermission only in CloudKit?


Doc says requestApplicationPermission not pops up alert view if permission is already granted, but returns the same completion handler as for statusForApplicationPermission, so then why not just skip statusForApplicationPermission check and ask only for permission?

statusForApplicationPermission returns significantly faster then requestApplicationPermission?


Solution

  • When you call requestApplicationPermission, the user is asked only once to enable the permission. If you want them to enable the permission it is good to give them some context so that they are more aware of what they are enabling.

    For that reason, you might wait until an opportune time to call requestApplicationPermission (for example when they try to discover other users). But you can call statusForApplicationPermission anytime without risking them telling you no (for example, at launch to maintain data for users who have enabled the permission).