I have a previously created Sqlite database file that I am bundling with an iOS application. My question is what is the best way to write this data to the phone so that I may alter the tables from the application there on?
My research indicates that I may need to loop through the entire .sql file and insert/create the necessary tables and values on the phone manually.
Is there no way to just write the database to internal storage and then manipulate it from then on?
You can add it to your supporting files in the project and then copy the file as a template db if it doesn’t exist and then open it. Once you open it you can do what you want with it.
Here’s some sample code from a sample project I had that does this. In my sample it’s a contact database. Notice how ensurePrepared will copy it from the bundle if it doesn’t exist. I copy to library path but you can copy to documents path.