How to maintain data in an SQLite Database on an iPhone at a version update of the application?

后端 未结 2 1155
北荒
北荒 2021-01-04 13:32

I have an SQLite database in the first version of my iPhone application (which is on the app store). Now I want to roll out the second version of the application, which also

2条回答
  •  滥情空心
    2021-01-04 14:03

    This isn't something I've personally tested, but to the best of my knowledge:

    1. Your first question's been answered, and the short of it is that you're out of luck if your sqlite db isn't copied to the Documents directory, since the entire app bundle will get replaced on upgrade. Assuming christo16 is right, and assuming that your already-shipped app didn't copy the db out to Documents, you might want to ship an interim version that does do this. Then it'd just be a matter of making sure a critical mass of users have installed the interim version before you roll out the db updates.
    2. Re: testing. You should be able to test the upgrade behavior by installing your build via iTunes instead of via Build & Run. It's been awhile since I tried it...following the instructions for an ad hoc build should do the trick, though it might be overkill.

提交回复
热议问题