+ entityForName:在此模型中找不到名为“Dogs”的实体。 [英] +entityForName: could not locate an entity named 'Dogs' in this model.

查看:227
本文介绍了+ entityForName:在此模型中找不到名为“Dogs”的实体。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关Core数据模型的一个小问题。

A little question regarding Core data models.

这是为什么我发布: + entityForName:这个模型中的狗。

我想做什么:
我想创建一个应用程序读取/写入核心数据有关2个实体的动物详情 Cats

- 为此,我创建一个使用核心数据检查基于窗口的项目。
- 然后我创建我的视图,并点击animals.xcdatamodeld文件创建一个名为 Cats 的第一个实体。我添加属性,生成类cats.h和cats.m。
- 我写下代码读写这个实体=>没有问题一切正常。

-For that I create a window-based project with "use core data" checked. -Then I create my views, and click on "animals.xcdatamodeld" file to create a first entity called Cats. I add the attributes, generate the class "cats.h" and "cats.m". - I write down the code to read and write on this entity => No problem everything works well.


  • 在这一点上我犯了一个错误,手动删除文件animals.xcdatamodeld...我用相同的名称重新创建它,并添加一个新实体及其属性和生成关联类。

  • At this point I made a mistake by deleting the file "animals.xcdatamodeld" manually... I recreate it with the same name and add a new entity Dogs with its attributes and generate the associated class.

这就是问题所在,当我构建并运行错误消息时: + entityForName:could not在这个模型中找到名为Dogs的实体。 FYI,对 Cats 的读/写仍然可以。

That's where the problem is, when I build and run the error message comes : +entityForName: could not locate an entity named 'Dogs' in this model. FYI, the read/write on Cats is still ok.

我不知道为什么会出现此错误...我没有更改任何应用程序代理。我发现网上很少有关于这个问题的信息。
这只是我发现的是,也许这个模型需要版本化更新=>有人可以解释一个lil位吗?
无论如何,当我添加新实体时,该模型似乎没有更新...

I have no idea why this error appears... I did not change anything on the App Delegate. I found very little information online related to that issue. This only thing I found was that maybe the model needs to be versioned when updated => Can someone explain that a lil bit please ? Anyway the model does not seem to have been updated when I added the new entity...

Thx。

推荐答案

确定为预期的某种方式,这个错误是由于一个愚蠢的错误...
删除的xcdatamodeld文件被替换为一个新的一个不同的拼写。 ..

Ok as expected somehow, this error was due to a stupid mistake... The deleted xcdatamodeld file was replaced by a new one with a different spelling...

现在一切正常...

这篇关于+ entityForName:在此模型中找不到名为“Dogs”的实体。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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