我在 iOS15 beta 4 上使用 NSPersistentCloudKitContainer 来跨设备同步核心数据。在设备上启动并登录 iCloud 时,我在日志中收到以下错误:
成功:0 madeChanges:0错误:
我有以下代码:
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 https://developer.apple.com/forums/thread/685857
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)