重命名Core Data类 [英] Renaming Core Data class
问题描述
我有一个使用CoreData的应用程序。
I have an application that uses CoreData.
我以前有一个名为Marker的类,它链接到Core Data中的Marker实体。
I previously had a class named Marker which was linked to the Marker entity in Core Data.
我将Marker类重命名为CoreDataMarker。所以我创建了一个新的.xcdatamodel文件与实体的新类名。然后,我创建了一个.xcmappingmodel并选择旧的和新的.xcdatamodel文件,它似乎自动设置罚款。
I renamed the Marker class to CoreDataMarker. So I created a new .xcdatamodel file with the new class name for the entity. Then I created a .xcmappingmodel and selected the old and the new .xcdatamodel files and it seemed to 'auto-setup' fine.
但是,当我运行我的应用程序抱怨:不能合并模型与两个不同的实体命名为'标记'。我知道这发生了,但我不知道该如何解决。
However, when I run my application it complains with: "Can't merge models with two different entities named 'Marker'". I understand that this happens, but I have no idea how to solve it.
你知道吗?
提前感谢!
推荐答案
您不需要新的xcdatamodel。将 Marker
实体的实体描述中的类字段更改为 CoreDataMarker
。这就是所需要的。实现类信息不需要模式迁移。
You don't need a new xcdatamodel. Change the in the "Class" field in the entity description for your Marker
entity to CoreDataMarker
. That's all that's needed. The implementing class information does not require a schema migration.
这篇关于重命名Core Data类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!