0

I'm trying to make my first framework for iOS.

I have core data in it, in my xcdatamodel I have two entites, I auto generated classes for both models, but when I print [[managedObjectModel entities] valueForKey:@"name"] I see only first entity.

Also when I try to init fetchRequest withEntityName of second entity I don't see it at all.

And the weirdest thing is that for first entity everything works perfectly. Also if I do updates inside first entity I can see it, so I believe that it has the latest version.

Nikola Klipa
  • 333
  • 3
  • 14

1 Answers1

0

As per my experience I have used all private variable and it will not access out side framework so that may be the case.

or you one more thing you have to specify your framework core data bundle path so that that entity will access by current project in which you have used dynamic framework.

Like this :

lazy var managedObjectModel: NSManagedObjectModel = {
    // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
    let carKitBundle = NSBundle(identifier: "YOUR_FRAMEWORK_BUNDLE_PATH")

    let modelURL = carKitBundle!.URLForResource("YOUR_MODEL_NAME", withExtension: "momd")!
    return NSManagedObjectModel(contentsOfURL: modelURL)!
}()

may be it will help you to get your entity in current project.

Let me know if it will solve your problem.

Thanks.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80