Question

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 graphical 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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top