如何解决iOS15 B4 NSPersistentCloudKitContainer“帐户暂时不可用”错误
我在 iOS15 beta 4 上使用 NSPersistentCloudKitContainer 来跨设备同步核心数据。在设备上启动并登录 iCloud 时,我在日志中收到以下错误:
我有以下代码:
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 指出的那样,seems to be fixed in beta 5 似乎是一个错误。 我在公共 CK 数据库中遇到了类似的问题。我会编辑这个,如果我能确认 b5 为我修复了它......
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。