I currently have an iOS app that can ‘bootstrap’ it’s database from a bunch of pList files (which I use during development when there are db changes) or copy a pre-existing database for the first run on a device (I use the database that was created in the simulator).
This is getting messy: I have to flip flags to decide whether I’m bootstrapping or not, I don’t want to distribute a ‘bootstrap’ version by accident, and I don’t want to distribute the plists either (then the target device would have 3 copies of the data: the bundled db, the plists, and the writeable copy of the db).
What I would like to do is create a separate desktop app that uses the same object model. The plists would be used by the desktop app, which I would run to generate the db (or maybe even provide a GUI for DB tweaks!). The iPhone and desktop app would share the same data model. And the desktop app would write to the db that’s bundled with the iOS app, so I don’t have to remember to copy from the simulator.
So far, I have been able to find posts that say that this would be trivial to do… but a tutorial or tips would be helpful.
Sasha,
I made a new target in my existing project and was able to create my bootstrapped Core Data DB. It wasn’t hard at all. You reuse most of your existing code.
Andrew