我有多个版本的 xcdatamodel 文件:
app1.0.xcdatamodel
app1.1.xcdatamodel
app1.2.xcdatamodel (current)
这是否意味着我需要 xcmappingmodel 文件的多种组合来覆盖所有升级方案?
app1.0_to_app1.1.xcmappingmodel (had this already)
app1.1_to_app1.2.xcmappingmodel (is it iterative?)
app1.0_to_app1.2.xcmappingmodel (too much?)
谢谢!
最佳答案
Core Data 要求您创建一个映射模型,以从当前版本的数据存储转换到最新版本的数据存储。这意味着您需要制作一个从 v1 -> v2 到 v2 -> v3 和 v1 -> v3 的版本。
摘自核心数据版本控制和迁移指南
Tries to find a mapping model that maps from the managed object model for the existing store to that in use by the persistent store coordinator. Core Data searches through your application’s resources for available mapping models and tests each in turn. If it cannot find a suitable mapping, Core Data returns NO and a suitable error.
Note that you must have created a suitable mapping model in order for this phase to succeed.
正如本 Apple 文档中所讨论的 Core Data Mapping
关于xcode - xcdatamodel的多个版本是否意味着我们需要多个xcmappingmodel文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9162590/