I have an existing project to which I have added Core Data models. I added a basic data structure, added a data model with entities and included it in my target program, as well as some of the generated NSManagedObject
classes. It compiles nicely, and now I would like to add some tests for the objects I created. Following these instructions , I installed the base class of logical tests using the setUp
method:
- (void)setUp { model = [NSManagedObjectModel mergedModelFromBundles:nil]; NSLog(@"model: %@", model); coord = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model]; store = [coord addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:NULL]; ctx = [[NSManagedObjectContext alloc] init]; [ctx setPersistentStoreCoordinator:coord]; }
This compiles and all objects are created. However, the model has no entities! The output of NSLog()
looks like this:
2011-10-29 23:56:58.941 otest[42682:3b03] model: (<NSManagedObjectModel: 0x19c6780>) isEditable 1, entities { }, fetch request templates { }
So where are my entities? I poked around the package and there are no .momd
files. Did I miss some important step to assemble my models?
source share