Home » Swift » Reset CloudKit Discoverability Permission

Reset CloudKit Discoverability Permission

Posted by: admin January 9, 2018 Leave a comment

Questions:

I’m testing code that requests discoverability via CloudKit:

    CKContainer.defaultContainer().requestApplicationPermission(CKApplicationPermissions.PermissionUserDiscoverability, completionHandler: { (status:CKApplicationPermissionStatus, error:NSError!) -> Void in
        if status == CKApplicationPermissionStatus.Granted {
            ...
        } else if status == CKApplicationPermissionStatus.Denied {
            ....
        } else {
            println("Request result: \(status)")
        }
    })

But how do I reset the result of this? I get asked once and never again, even if I delete and reinstall the app. If I run this code again, I get into the completion block immediately with the same result as last time.

I saw another question and a post on Apple’s old forums (login required) that said it could be reset by going to Settings –> iCloud –> iCloud Drive –> Look Me Up By Email. However doing that doesn’t give me any option to do anything:

Look Me Up By Email screen

I’m sure I could reset it by something like Settings –> General –> Reset –> Reset All Settings (or maybe Reset Network Settings) [but see additional info on this], but there must be some way to reset the CloudKit permission without nuking a bunch of unrelated settings. What if a user denies permission but later changes their mind?

Update: Some additional info:

  • On the simulator, Settings –> General –> Rest –> Reset Location & Privacy has no effect.
  • Also on the simulator, “Reset Content and Settings…” has no effect.
  • Trying on a different Mac, with a different device, produces exactly the same results.

The above lead me to suspect it’s a server-side setting. So I tried logging into iCloud.com with the account I’m using, and went to Settings –> Data & Security –> Look Me Up By Email. As on iOS devices and simulators, there is no option there to do anything at all:

Look Me Up By Email at iCloud.com

So, is there any way at all to reset this, or is it fixed in stone and unchangeable until the sun expands and destroys the Earth?

Answers:

The “Look Me Up By Email” settings currently only show your preferences in the production environment. If your app is running in the development environment there’s no way to reset those settings at the moment. You’re correct that the setting is stored on the server.

This is a known bug. Until it gets fixed the work around is to test this feature while your app is deployed for production. You can create a second container to use for testing this if you want to avoid testing in your shipping app’s production container.

Questions:
Answers:

Before the sun expands and destroys the earth, this setting can be reset as follows:

  • log into your CloudKit Dashboard
  • select your app’s container
  • select your Development environment
  • click on the Deployment tab on the left, under Admin
  • click on the Reset Development Environment button on the top right.

(These instructions only work for the Development environment.)

Questions:
Answers:

Only way I found is reseting development environment from CloudKit dashboard, app will ask for permission again, this will delete all your data though