I have an application that is finished except for the problem i am trying to fix in this question. I have been asking about this before but i guess asked the wrong question so i give it a new go. I do apologize that i have started this tread: refresh SQLITE3 (Core Data) on device and app store and ask again but i am desperate.
Again, i am not asking about writing into the database but refresh the whole, pre-populated, database at build time.
Here is the sequence:
I run the application in the simulator, the DB is located in the documents directory
Type the magic password (which will not be available in the app store code)
a. The app deletes all records in the DB
b. Read new/updated data from .txt file and populate the database
Continue or restart the app in the simulator, the DB is updated with new/updated data
Attach my test device, with the app already installed and run a build
a. All code based changes is reflected and works as in the simulator
b. The DB is not updated and still shows the "old" data, the updates (2b) is not installed
Here is the problem, i want to update the database via the rebuild but that only works in the simulator. I know i can probably do it via a website or similar but that is not what i try to solve here.
I read somewhere that data in the documents directory is kept at build, is that true?
I guess one scenario is to add the .txt files in the build and update the DB in the app when finding the new .txt file.
Can someone nice give a desperate man some advice and maybe some examples how i should do this so the updated database is also distributed at the build?
====SOLVED====
After a lot of testing i decided to move in the .txt files into the bundle and do the update in the phone rather than moving the sqlite3 DB.
Documents directory contents are not connected with build in any way. To make that work, you should copy database to your project folder and add it to your project. Since then it will be copied to your device.