0

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!

manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216

1 Answers1

0

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.

WrightsCS
  • 50,551
  • 22
  • 134
  • 186