NSEntityDescription entityForName returning nil

Posted by Kamchatka on Stack Overflow See other posts from Stack Overflow or by Kamchatka
Published on 2010-06-12T23:17:39Z Indexed on 2010/06/12 23:22 UTC
Read the original article Hit count: 289

Hi,

I did some changes to my model (but I don't want migration yet, so I just remove the application, built clean etc.) so my application works in the simulator.

However, when I run it on the iPhone, I get the following error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.'

I set the entity like this:

NSEntityDescription *entity = [NSEntityDescription entityForName:@"Document" inManagedObjectContext:managedObjectContext];

My managedObjectContext is not nil. But I suspect that it doesn't load the object model correctly or something similar because If I display the entities in the model, the list is empty. How can I make sure the model is loaded?

Thanks,

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk