Problems creating a static library using CoreData - it is not possible to create an NSPsistentStoreCoordinator with a null model

How do I reference the model that I created in my static library project?

This returns null, as well as errors and throws, because 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 can I change this to extract from this static library?

+5
source share
2 answers

On iPhone, static libraries have the extension .a and can only contain code. This means that any resources (xibs, images, etc.) must be packaged either in a package or sent separately than the library.

See iOS library with resources

+4
source

, , Entity API, .

+4

All Articles