Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple Unrelated Entities in one Core Data Model
    primarykey
    data
    text
    <p>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.</p> <p>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:</p> <pre><code>// 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]; </code></pre> <p>I should note that the MOM is only initialized only once in the AppDelegate based on the XCode template.</p> <p>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:</p> <pre><code>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'' </code></pre> <p>I'm probably missing something basic and doing something really stupid, but any help here would be appreciated.</p> <p>Thanks,<br> Paul</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload