I’m developing my first OS X application which will be distributed through Mac App Store.
The app makes use of an sqlite database which I am currently keeping on the same location as the rest of app file dependencies.
I’m using Qt Framework to develop the application.
Keeping within the boundaries of App Store rules;
-
Where can I locate the database file for it not to be overridden during app updates?
-
How should I structure the .app folder and all the dependencies?
Thank you.
Your question implies that you are writing to the sqlite database, which is a bad idea given the application will be stored in a location (
/Applications) that the user may not have write-access to.What you should do is copy/create the database to a user-writable area (the
Documentsfolder of the app’s container will do) upon first use (or when you detect it’s not there) and use it from there.EDIT: In order to get the Documents directory use this code:
This will give you the location of the app container
Documentsdirectory, not the user’s Documents directory when the app is sandboxed: