A little question regarding Core data models.
Here is why I'm posting : +entityForName: could not locate an entity named 'Dogs' in this model.
What I wanna do :
I wanna create an app that will rea开发者_如何学编程d/write in core data details about animals with 2 entities Cats
and Dogs
.
-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.
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.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 onCats
is still ok.
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.
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...
Now everything's fine...
精彩评论