Hi,
I want to have the equivalent of two completely unrelated tables in my database, and for this I have defined two different entities in my Core Data model.
Further to this, I have a different ViewController making use of each of these entities and therefore I'm initializing two different fetchedResultsController (one in each ViewController) in this manner:
// Create the fetch request for the entity.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Edit the entity name as appropriate.
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event"
inManagedObjectContext:managedObjectContext];
[fetchRequest setEntity:entity];
I should note that the MOM is only initialized only once in the AppDelegate based on the XCode template.
It all worked fine when I only had one ViewController and a single entity in the model, however even though I have the 2nd entity defined in the model I cannot get the 2nd ViewController to initialize the fetchedResultsController (again based on the XCode template). I always get the following error:
2010-02-11 22:02:55.078 JournalTool[3094:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'EventTag''
I'm probably missing something basic and doing something really stupid, but any help here would be appreciated.
Thanks,
Paul