0

I am trying to request permission using the function:

func requestPermission() {
        CKContainer.default().requestApplicationPermission([.userDiscoverability]) { [weak self] returnedStatus,
            returnedError in
            DispatchQueue.main.async {
                if returnedStatus == .granted {
                self?.permissionStatus = true
                }
            }
        }
    }

but it is not requesting permission in the simulator. I am signed into iCloud and it is still not working. Any ideas?

Marcus Grant
  • 11
  • 1
  • 3
  • For me when signing into iCloud developer account on the simulator, it doesn't work. Use a real device and sign in to iCloud with your personal account and try. On the CloudKit dashboard you have an option called as "Act as iCloud" which allows you sign in with any personal iCloud account and debug – user1046037 Aug 11 '22 at 17:41

2 Answers2

0

Looks like your container name is not same as bundle name, so CKContainer.default() is not working properly. Here is the answer: https://stackoverflow.com/a/64870294/13947736

Vladimir Moor
  • 81
  • 1
  • 5
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32923987) – Mohamed Elkassas Oct 17 '22 at 11:04
0

First try with your container name instead of the CKContainer.default(). Try CKContainer(identifier: "your.container.name")

Then if you are still getting a "Request failed with http status code 503" error from the server, Try logging into your iCloud console. And set an index for your table and make it queryable. This should fix your issue. It worked for me.