samedi 26 mars 2016

Read-only SQLite database in application bundle

Assume I have bundled a large internal reference data SQLite database with my iOS application. It will never be written to at runtime and may only change with a new app release.

Generally, pre-generated SQLite database files would be copied into the app's Library or user Documents directory before being used, to allow read access. But since it's not required in this case: is there any harm, potential performance issue, or other problem with keeping the file in the app bundle and using it from there?

In other words:

let myBundledDatabase = NSBundle.mainBundle().pathForResource("MyDatabase", ofType: "db")!
sqlite3_open(myBundledDatabase, // ...

Aucun commentaire:

Enregistrer un commentaire