How can I copy sqlite file back to main bundle after updating the database? Now I copy sqlite file into Documents directory, insert new records than select all from it, and I can see that the data is there, old and new one. How to update the main database which I copied? Thank you for your time and help.
Asked
Active
Viewed 263 times
2 Answers
2
Actually you cannot change the app bundle files. Once you changed the app bundle files it invalidates the app sign and it will install anymore. You have to copy the app bundle files to App Documents directory and always use the files in documents directory.
-
Yes, I fixed it. I was overwriting the database all the time, that's why I could't see changes. Now it works fine. – matt koder Nov 17 '15 at 09:38
-
I just did.. But answers before also helped me, so I gave everyone +1. :) – matt koder Nov 17 '15 at 09:43
-
Oh.. Cool. Thank you matt.. will keep in touch. – shlok Nov 17 '15 at 09:45
1
No you can't copy sqlite file back to main bundle because app bundle is read-only!

larva
- 4,687
- 1
- 24
- 44
-
How can I update sqlite database then after changes? Because when I shut down the application, database is the same as it was on the beginning. No change is saved. – matt koder Nov 17 '15 at 09:22
-
1You have to check if you've already copied the database from the bundle to the Documents directory. If you have, don't overwrite it. – Avi Nov 17 '15 at 09:27
-
1@mattkoder just copy sqlite file to documents directory if it's not exist in documents – larva Nov 17 '15 at 09:28
-
i feel like such a noob... Thank you. I needed this line of code: if (![fileManager fileExistsAtPath:copyDBPath]) { } – matt koder Nov 17 '15 at 09:35