iOS15 B4 NSPersistentCloudKitContainer "Account Temporarily Unavailable" error



我在iOS15 beta 4上使用NSPersistentCloudKitContainer来跨设备同步核心数据。当在设备上启动时,登录到iCloud,我在日志中收到以下错误:

& lt; NSCloudKitMirroringResult: 0 x28167ae60>success: 0 madeChanges: 0 error:

我有以下代码:

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引入的一个bug - https://developer.apple.com/forums/thread/685857

正如@ryannnn指出的,这似乎是一个bug,似乎在beta 5中被修复了。我有一个类似的问题,特别是与公共CK数据库。我会编辑这个,如果我能确认b5为我修复了它…

编辑:它确实修复了Account Temporarily Unavailable问题。然而,iCloud同步仍然只在应用安装后的第一次会话中发生。当它再次运行时,在它安装后,我仍然得到<CKError 0x281fe43f0: "Server Rejected Request" (15/2027); server message = "Custom zones are not allowed in public DB"; op = *****; uuid = ***-***-***>

相关内容

最新更新