I'm using NSPersistentCloudKitContainer on iOS15 beta 4 to sync core data across devices. When launching on device, logged into iCloud, I receive the following error in the logs:
<NSCloudKitMirroringResult: 0x28167ae60> success: 0 madeChanges: 0 error: <CKError 0x2818a94d0: "Account Temporarily Unavailable" (1028/2011); "Account temporarily unavailable due to bad or missing auth token">
I have the following code:
init(inMemory: Bool = false) {
container = NSPersistentCloudKitContainer(name: "AppName")
if inMemory {
let storeDescription = NSPersistentStoreDescription(url: URL(fileURLWithPath: "/dev/null"))
container.persistentStoreDescriptions = [storeDescription]
} else {
let storeURL = URL.storeURL(for: "my.app.group", databaseName: "AppName")
let storeDescription = NSPersistentStoreDescription(url: storeURL)
storeDescription.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.my.app")
container.persistentStoreDescriptions = [storeDescription]
}
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
}
这似乎是 beta 4 中引入的错误 - https://developer.apple.com/forums/thread/685857
As @ryannnn pointed out it seems to be a bug that seems to be fixed in beta 5 . I had a similar problem specifically with the public CK database. I'll edit this, if I can confirm that b5 fixed it for me...
EDIT: it did fix the Account Temporarily Unavailable
issue. However, the iCloud sync still only happens while in the first session after app install. When running it again, after it's installed I still get <CKError 0x281fe43f0: "Server Rejected Request" (15/2027); server message = "Custom zones are not allowed in public DB"; op = *****; uuid = ***-***-***>
<CKError 0x281fe43f0: "Server Rejected Request" (15/2027); server message = "Custom zones are not allowed in public DB"; op = *****; uuid = ***-***-***>
<CKError 0x281fe43f0: "Server Rejected Request" (15/2027); server message = "Custom zones are not allowed in public DB"; op = *****; uuid = ***-***-***>
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.