简体   繁体   English

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

[英]iOS15 B4 NSPersistentCloudKitContainer "Account Temporarily Unavailable" Error

I'm using NSPersistentCloudKitContainer on iOS15 beta 4 to sync core data across devices.我在 iOS15 beta 4 上使用 NSPersistentCloudKitContainer 跨设备同步核心数据。 When launching on device, logged into iCloud, I receive the following error in the logs:在设备上启动并登录 iCloud 时,我在日志中收到以下错误:

<NSCloudKitMirroringResult: 0x28167ae60> success: 0 madeChanges: 0 error: <CKError 0x2818a94d0: "Account Temporarily Unavailable" (1028/2011); <NSCloudKitMirroringResult: 0x28167ae60> 成功: 0 madeChanges: 0 错误: <CKError 0x2818a94d0: “账户暂时不可用” (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 .正如@ryannnn 指出的那样,这似乎是一个似乎已在 beta 5 中修复的错误。 I had a similar problem specifically with the public CK database.我在公共 CK 数据库中遇到了类似的问题。 I'll edit this, if I can confirm that b5 fixed it for me...我会编辑这个,如果我能确认 b5 为我修复了它......

EDIT: it did fix the Account Temporarily Unavailable issue.编辑:它确实解决了Account Temporarily Unavailable的问题。 However, the iCloud sync still only happens while in the first session after app install.然而,iCloud 同步仍然只在应用安装后的第一个 session 发生。 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 = ***-***-***> <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