problems creating static library with CoreData - Cannot create an NSPersistentStoreCoordinator with a nil model
core-data, ios, iphone, objective-c
Solution
On the iPhone, static libraries have a .a extention and can only contain code. This means that any resources (xibs, images, etc…) must be packed either in a bundle or shipped separately than the library.
See iOS Library With Resources
Problem
How do I reference the Model that I have created in my static library project? This returns null and throws and error because the resources live in this static library: ``` //this code is in the static library - (NSManagedObjectModel *)managedObjectModel { if (__managedObjectModel != nil) { return __managedObjectModel; } NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"eCommerceEngine" withExtension:@"mom"]; __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; return __managedObjectModel; } ``` How do I change this to pull from this static library?