核心数据实体重命名 [英] Core Data Entity rename

查看:96
本文介绍了核心数据实体重命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个名为 MyObject的核心数据实体。然后,我将实体重命名为 ThatObject。但是,每次创建NSManagedObject子类时,它仍然会将.h / .m文件创建为MyObject。

I created a Core Data Entity called "MyObject". I then renamed the entity "ThatObject". But every time I create a NSManagedObject subclass, it still creates the .h/.m file as MyObject.

我将 MyObject文件命名为 ThatObject,一切正常,但是每次我更改实体属性时都必须这样做。

I take the "MyObject" files and just rename them to "ThatObject" and everything works, but its annoying to have to do that everytime i alter the entity attributes.

任何想法如何解决此问题?

Any idea how to fix this?

推荐答案

重命名实体时,请确保同时重命名 Name 数据模型检查器中的类。在我的项目中,如果两个都被重命名,则会使用新名称创建自动生成的新NSManagedObject子类。

When you are renaming the entity make sure you rename both Name and Class in the Data Model Inspector. In my project, if both are renamed the new auto-generated NSManagedObject subclasses are created with the new names.

这篇关于核心数据实体重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆