I have a CoreData
database which works on the root view controller. I have a second UIViewController
of which when I switch to, and use the same exact line to fetch NSEntityDescription
, I get the following error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: +entityForName: could not locate an NSManagedObjectModel for entity name 'Channel''
I am doing that as follows:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Channel" inManagedObjectContext:self.context];
[fetchRequest setEntity:entity];
The error hits at the NSEntityDescription *entity
line. How is this possible if the line works on another UIViewController
?
Thank you