문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top