I have a pre-existing project to which I've added Core Data models. I added the Core Data framework, added a data model with entities, and included it in my app's target, along with some generated NSManagedObject
classes. It compiles nicely, and now I'd like to add some tests for the entities I've created. Following these instructions, I've set up a logic test base class with a setUp
method like so:
- (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 the objects are created. However, the model has no entities! The NSLog()
output looks like so:
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've poked around the bundle, and there are no .momd
files, either. Have I missed some crucial step to get my models to build?