【发布时间】:2017-01-16 10:38:18
【问题描述】:
我真的需要帮助来更改核心数据结构。我已经使用现有数据库构建了我的应用程序,但现在我想使用 Seam cloudKit 同步,我必须更改我的代码,但如果我这样做,我的应用程序将会崩溃! (删除并再次构建应用程序不是一种选择。正如我提到的那样,它已经有了它的数据结构)
在NSPersistentStoreCoordinator我使用了以下代码:
try coordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: [NSMigratePersistentStoresAutomaticallyOption: true,NSInferMappingModelAutomaticallyOption: true])
现在我必须使用它:
try coordinator.addPersistentStore(ofType: SMStore.type, configurationName: nil, at: url, options: [NSMigratePersistentStoresAutomaticallyOption: true,NSInferMappingModelAutomaticallyOption: true]) as? SMStore
正如你所注意到的,我必须将 ofType 从 NSSQLiteStoreType 更改为 SMStore.type
有没有办法做到这一点?有人知道吗?我希望有人可以提供帮助。
非常感谢。
【问题讨论】:
标签: ios swift sqlite core-data cloudkit