-3

Fellows!

I have an app using Core Data where I created one Entity (let's call "Entity1") and one attribute. I implemented it and the app was running perfectly. It was reading, writing and deleting datas.

So, I created a second entity ("Entity2") and I didn´t implement any code related to "Entity2". However, neither "Entity1" nor "Entity2" was running anymore.

After that, I deleted "Entity2" and the app started working perfectly again.

Could you tell me if there is any secret to create multiple entities in Core Data.

4

1 回答 1

1

这是因为您的模型文件(xcdatamodel)和您现有的数据库不匹配。尝试在模拟器或开发设备中删除您的应用程序,然后再次构建并运行,应该可以了。

而且,这只是为了开发。当你发布了你的应用程序,然后想要更改数据库模型时,不可能要求你的用户“删除你的应用程序并重新安装”。这个时候,你需要一个核心数据模型版本控制和数据迁移。不过那是另一回事了。

我认为你应该从核心数据的基础开始。请参阅本教程以熟悉它。:)

于 2013-03-25T15:28:17.577 回答