繁体   English   中英

iOS15 B4 NSPersistentCloudKitContainer“账户暂时不可用”错误

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM