![](/img/trans.png)
[英]iOS15: NSPersistentCloudKitContainer: how to un-share objects?
[英]iOS15 B4 NSPersistentCloudKitContainer "Account Temporarily Unavailable" Error
我在 iOS15 beta 4 上使用 NSPersistentCloudKitContainer 跨設備同步核心數據。 在設備上啟動並登錄 iCloud 時,我在日志中收到以下錯誤:
<NSCloudKitMirroringResult: 0x28167ae60> 成功: 0 madeChanges: 0 錯誤: <CKError 0x2818a94d0: “賬戶暫時不可用” (1028/2011); “由於授權令牌錯誤或丟失,帳戶暫時不可用”>
我有以下代碼:
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
正如@ryannnn 指出的那樣,這似乎是一個似乎已在 beta 5 中修復的錯誤。 我在公共 CK 數據庫中遇到了類似的問題。 我會編輯這個,如果我能確認 b5 為我修復了它......
編輯:它確實解決了Account Temporarily Unavailable
的問題。 然而,iCloud 同步仍然只在應用安裝后的第一個 session 發生。 再次運行時,安裝后我仍然得到<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 = ***-***-***>
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.