I've been commissioned to update a native iOS app, but as we're also going to release it to other platforms, we're are writing the new version using Appcelerator's Titanium.
The current app uses a SQLite database to store user information. How do I access the existing SQLite database when the user updates their app to the new one? We don't want to lose any data. I assumed I would be able to access the old database and then create a migration to a new database.
And what is the best way to test this? Can I install a test app with the same app id or perhaps bundle id to simulate an update?
Thanks, Tom
This should be possible (although it can get tricky) as long as the previous developers observed Apple rules on where the user information db was stored.
As long as you have the same bundle ID, and increment the version, you can overwrite the existing app during testing to simulate an update (make sure you are using an Ad-hoc distribution), this will leave the user files in place. From there, when you load your app for the first time, load that DB in the usual way:
iOS has a specific directory where they keep DB files, and the newest version of Titanium migrates any old DB's to this directory.