1

The cloudkit CKContainer requestApplicationPermission() method shows an Alert to ask the user for his discoverability permission only ONCE based on the documentation and any future invocations of this method do not show the Alert any longer.

From documentation at : CKContainer.requestApplicationPermission() "The first time you request a permission on any of the user’s devices, the user is prompted to grant or deny the request. Once the user grants or denies a permission, subsequent requests for the same permission (on the same or separate devices) do not prompt the user again."

So, what happens if the user changes his mind, and I want my application to ask the user if he has changed his mind and show the alert again, how can that happen? There has to be a way, but I can'f find any documentation about it.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
malena
  • 798
  • 11
  • 26
  • 3
    There is no way, you have to tell the user to alter their settings. – jonrsharpe Jul 23 '16 at 23:53
  • Hi Jon, so if my application asks the user to alter their settings, how can they do it ? Not sure if you are saying that they can go to the iphone settings and do it manually? Could you elaborate? – malena Jul 24 '16 at 02:23

1 Answers1

1

First, check if the user has previously denied the permission with:

CKContainer.statusForApplicationPermission()

If the status returned in the completionHandler is CKApplicationPermissionStatus.Denied, show a UIAlertController asking if the user wants to enable it in settings.

If the user says yes, you can go to your app settings page like this:

if let settingsURL = NSURL(string: UIApplicationOpenSettingsURLString) {
    UIApplication.sharedApplication().openURL(settingsURL)
}
Yann Bodson
  • 1,634
  • 1
  • 17
  • 29
  • 1
    If you're using CloudKit (especially the development container) the discoverability permission is maintained in CloudKit. At present, there is no way to reset this from iOS. You need to reset your development environment & clear all data. Next time the app is run the user will be prompted. Apple really needs to address this and allow for updating this response by the user in iOS. – Wizkid Mar 04 '18 at 23:49