I'm trying to migrate a specific part of one of my apps into a framework so that I can use it in my app itself and in one of those fancy new iOS 8 widgets. This part is the one that handles all my data in Core Data. It's pretty straight forward to move everything over and to access it. I'm just having trouble accessing my momd file in there.
When creating the NSManagedObjectModel I still try to load the momd as illustrated in Apple's code templates:
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyApp" withExtension:@"momd"];
__managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
Unfortunately, modelURL stays nil and thus MyApp crashes when accessing the Core Data stack with this error:
2014-08-01 22:39:56.885 MyApp[81375:7417914] Cannot create an NSPersistentStoreCoordinator with a nil model
2014-08-01 22:39:56.903 MyApp[81375:7417914] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'
So, what's the right way to do this when working inside a framework with Core Data?

I assume you only require the data model.
If so, I find the following is consistently the most successful method for copying across a data model file from one project to another...
Delete any current copies of
.xcdatamodeldfile that reside in the target project.Close Xcode.
Using Finder (or cmd line);
Select your Xcode project folder that contains the original
.xcdatamodeldfile.Make a copy of the original
.xcdatamodeldfile.Move the copy of the original
.xcdatamodeldfile to your target project.Then...
Open Xcode.
Using the Menu command "Add Files to >your project<", find and add the copy of the original
.xcdatamodeldfile to your project.Rename the original
.xcdatamodeldfile (if necessary) using Project Navigator."Build & Run" your target project.
Does this help?