Reputation: 5616
Would it theoretically be possible to download a Core Data database straight into an app and then access this database ?
If so what formatting considerations would there be - would any SQLite database work or would a specific structure be required ?
Upvotes: 3
Views: 612
Reputation: 119242
An alternative to the CLI tool mentioned by Marcus Zarra is to create a full GUI Mac app. With Cocoa bindings this is very straightforward, and will give you a visual editor for your pre-packaged database as well.
I've written about this concept here and there is an example project on GitHub which contains both Mac and iOS apps.
Upvotes: 1
Reputation: 46718
Core Data's database structure is closed meaning that you cannot and should not attempt to replicate it. The only recommended way to download a pre-populated database is to use Core Data. Fortunately OS X and iOS share the exact same structure (and will do so going forward).
The recommended way to handle this is to write a CLI for OS X that generates the SQLite file for you. Then you can download that file into your application as needed. This is also recommended for shipping a pre-populated database with your application (which is usually a better option than downloading an entire file).
Upvotes: 10