Search code examples
ioscore-datacordovansmanagedobjectcontext

Access Core Data From Previous iOS Application in new PhoneGap Application


I have an existing iOS application that I am in the process of rewriting. The new implementation is using web technologies and PhoneGap for native functionality.

This new implementation will update/replace the existing application.

In my new PhoneGap application I need to access the core data that the previous application wrote. So far I have made sure that the app ID on the new application is identical to the app ID on the previous application. I have copied the .xcdatamodeld folder from the old app to the new app, and added the core data framework to my new app.

My issue is that I cannot seem to access a managed object context from the PhoneGap plugin.

In my existing application I get the managedObjectContext from the AppDelegate, but I don't see how that object is created/initialized.

Where does the managedObjectContext come from? Where is it initialized?

Is there a project setting that I am missing?

Am I taking the wrong approach?


Solution

  • What I ended up needing to do was to add the core data stack code from my previous app delegate to my new app delegate.

    Adding Core Data to existing iPhone project helped point me in the right direction