How to work with iOS Core Data using NativeScript?


#1

I am looking to work with Core Data APIs from native iOS code, but I am facing the error “Failed to load model named MyModel”. Is it possible to do so?

The steps I followed are:
1.Created the project with NativeScript CLI
2. Opened ios project in Xcode. Works fine.
3. Added Core Data model file in Xcode project.
4. Now trying to load the model for persistentContainer in myComponent.ts file like this :
var persistentContainer = NSPersistentContainer.alloc().initWithName(‘MyModel’);
This is showing me console error “Failed to load model named MyModel” while executing “tns run ios”.

Is there any plugin doing the same? Is there any other way? Any help is appereciated.

Thanks