CloudKit iOS 10 Error: Account doesn't have access to CloudKit account

For some reason, a small subset of my users on iOS 10 are unable to read from my public iCloud container.

The localisedError that CloudKit returns is "Account doesn't have access to CloudKit account", however after searching online, I can't find any mention of this error.


Does anyone have any ideas what would cause this? They are signed into iCloud (I have asked a few to sign out/in again but this hasnt resolved), have iCloud Drive enabled and also "Use Mobile Data" enabled too in iCloud Drive settings.


Example code sample below.


let sortDescriptor = NSSortDescriptor.init(key: "Version", ascending: false) 
let publicDatabase = CKContainer(identifier:"iCloud.blah.blah.blah").publicCloudDatabase 
let truePredicate = NSPredicate(value: true) 
let VersionQuery = CKQuery(recordType: "Version", predicate: truePredicate) 
VersionQuery.sortDescriptors = [sortDescriptor] 

publicDatabase.performQuery(VersionQuery, inZoneWithID: nil) { (record, error) -> Void in 
    print("Cloudkit Error = \(error?.localizedDescription)") 
}

HI!


Can you post the complete error including potential sub-errors? Sometimes, these are more helpful than the localizedDescription.

Maybe yo can try this:


    func isICloudAvailable() -> Bool{
        if let _ = FileManager.default.ubiquityIdentityToken{
            return true
        } else {
            return false
        }
    }

let iCloudAvailable =  isICloudAvailable()
print("iCloudAvailable: \(iCloudAvailable)")


Instance Property


ubiquityIdentityToken


An opaque token that represents the current user’s iCloud identity


When iCloud is currently available, this property contains an opaque object representing the identity of the current user.


If iCloud is unavailable for any reason or there is no logged-in user, the value of this property is nil.


Accessing the value of this property is relatively fast so you can check the value at launch time from your app’s main thread.

Having the same issue here. Here is some stuff from the log where it happened:


cloudd(CloudKitDaemon)[135] <Info>: Checking TCC authorization for bundleID:<private> with 1 proxy

cloudd(CloudKitDaemon)[135] <Info>: TCC accepted a token for bundleID:<private>, proxy:<private>

cloudd(CloudKitDaemon)[135] <Error>: Error getting CloudKit auth token: <private>

cloudd(CloudKitDaemon)[135] <Error>: Finishing request with error 0x17dafe80

cloudd(CloudKitDaemon)[135] <Error>: Error fetching database URL from the server: <private>

cloudd(CloudKitDaemon)[135] <Info>: req: <private>, "<private>, did finish request <private> with error <private>"

cloudd(CloudKitDaemon)[135] <Notice>: [Operation 0x17d422e0] Operation is finishing on callback queue with an error

cloudd(CloudKitDaemon)[135] <Notice>: [Operation 0x17d422e0] Operation is getting flow controlled due to a local error

cloudd(CloudKitDaemon)[135] <Info>: Got an error from CKDContainerSpecificInfoOperation: <private>

cloudd(CloudKitDaemon)[135] <Info>: Finished operation <private> with error: <private>

cloudd(CloudKitDaemon)[135] <Error>: Finishing request with error 0x17dafe80

cloudd(CloudKitDaemon)[135] <Info>: Fetch records url request completed. Waiting for all record callbacks to finish before completing request <private>

cloudd(CloudKitDaemon)[135] <Notice>: [Operation 0x17ef8bb0] Request 0x0 set on operation

cloudd(CloudKitDaemon)[135] <Info>: req: <private>, "<private>, did finish request <private> with error <private>"

cloudd(CloudKitDaemon)[135] <Info>: All record callbacks are complete. Finishing request <private>

cloudd(CloudKitDaemon)[135] <Info>: Failed to fetch records for <private>: <private>

cloudd(CloudKitDaemon)[135] <Notice>: [Operation 0x17ef8bb0] Operation transitioning from state 2 (cancelled=0, stop=0, error=1)

cloudd(CloudKitDaemon)[135] <Notice>: [Operation 0x17ef8bb0] Operation is finishing on callback queue with an error

cloudd(CloudKitDaemon)[135] <Notice>: [Operation 0x17ef8bb0] Operation is getting flow controlled due to a local error

cloudd(CloudKitDaemon)[135] <Info>: Finished operation <private> with error: <private>


My log of the error:

<CKError 0x145eceb0: "Not Authenticated" (9/1002); "Account doesn't have access to CloudKit account">


This started on iOS 10.1 Beta.

I'm having this same problem - reported by users of an app. I can't reproduce it myself, either on iOS 10 or the 10.1 beta, but I definitely have users experiencing it (the "Account doesn't have access to CloudKit account" error) - despite ONLY trying to fetch public data. This is a serious problem.

I too am having the same problem. However, it seems that my users that are experiencing this have iCloud Drive turned off. This wasn't the case before iOS 10. Once the user turns on iCloud Drive, the problem goes away and users can read from the public container once again. I am submitting a bug report.

I can confirm this issue is related to iCloud Drive being turned off. Apple told me on Friday that's a known bug in iOS 10.


Pretty major bug if you ask me. I'm not sure how they can let out versions of iOS to the public with this level of bug, and they don't fix it after this amount of time!


If iCloud is going to be this unreliable, how can they expect developers to trust it enough to base their apps on it?

happens in iOS15.2. still an issue. have to re-login to iCloud and then restart device to get CoreData-CloudKit syncing to resume.

Seems iCloud kicks you out with large sync volumes and then locks up.

CloudKit iOS 10 Error: Account doesn't have access to CloudKit account
 
 
Q