Hi supportive experts...
I'm writing my first iPad app and have a working beta copy that parses an XML file to create a UIManagedDocument
Core Data DB on app start up. However this takes a long time and I would like to do it once off line and include the initial data directly into my app bundle.
Needless to say I'm hitting a wall trying to get it to work.
I first followed the command line utility approach see here This worked until I imported the .sqlite file and tried to edit the persistentStoreCoordinator
method - I'm using a UIManagedDocument
and so don't have a persistenStoreCoordinator
method in my AppDelegate
- this page quote "In some cases, you do not have to write any code to load a model. If you use a document-based application on Mac OS X, NSPersistentDocument
manages the task of finding and loading your application’s model for you."
I then tried to copy the UIManagedDocument
from a working version of my app in the simulator as per this StackOverFlow question
This seemed to work except that the persistentStore
is empty and hence my table is also. This is exactly the problem asked here but the response given to that question takes me right back into modifying the NSPersistentStoreCoordinator
method that I don't have.
I added a test NSFetchRequest
into my code where I copied the UIManagedDocument
from my app bundle into the documents directory - so I know that my UIManagedDocument
in my app bundle is empty. I have tried dragging and dropping from finder and coping using terminal - the persistentStore file seems to be correctly moved and have size 106 KB but I still get an empty DB in my App.
Any suggestions on how to get this to work?
Do I need to use configurePersistenStoreCoordinatorForURL:ofType:modleConfiguration:StoreOptions:error:
as per the UIManagedDocument
Class Reference - if so how would I do it?
Do I need to add some of the core data methods into my AppDelegate so I can modify my persistenStoreCoordinator
method - if so what else does this method have to do?
Am I better using the .sqlite DB that my command line utlity created or the persistentStore
UIManagedDocument
seems to use?