开发者

NSException in table view core data

Im developing an app that shows basic info from a coredata db, I have the db saving info when hit save button, but when I want to show the data in another view in a table, I get no errors, but an NSexeption>

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:    '+entityForName: could not locate an NSManagedObjectModel for entity name 'Contacts''

the data is saving correctly as I checked it in a sqlite graphic开发者_运维问答al interface, but not showing in the table, with the above error,

how to fix it please?

my little project is in here!

thank you so much!


Okay, your managedObjectContext needs to come from the App Deleagte, in ShowViewController try:

    managedObjectContext = [(CoreDataEnsaAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];

Right now, the context is coming form _context, which is NULL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜