Updating an iOS app and having the SQLite3 tables not be replaced
I have an iPhone app, and it has a database in it that gets updated when the user does some stuff in the app. I'm concerned that when I push an update, it will push the empty datab开发者_C百科ase too, getting rid of all their data. How can I tell Apple to not replace the database? How can I keep all the user's settings and information that they will not want to lose in the app?
If you update data in the DB, you must already be copying it from the Resources folder to the Documents folder. Otherwise, your codesigned app would refuse to launch after the first time it inserts/updates data in the database.
Thus, all you have to do is make sure your own application doesn't overwrite the existing database. When you update an app, the Documents folder stays untouched so from the app's perspective it doesn't know if it was just launched for the very first time, a second time or just updated.
精彩评论