I have developed an iPhone app using Monotouch and am about to do some user testing and run a trial once every 90 minutes on the same task with a different user. Therefore I need to 'zero' the app to avoid biases from the previous user's work. Since the data is stored in SQLite, is there a way to programmatically backup the iPhone data within Monotouch, either to a remote server or to a file persistent on the device?
-
I'm not sure if I understand your question. Sounds like chicken-egg: If you want to wipe everything after each test, why do you bother backing data up? And if you want to back data up, why would you then delete it...?Krumelur– Krumelur2012-03-11 12:08:49 +00:00Commented Mar 11, 2012 at 12:08
-
basically, I would like to keep the data generated by each user. Just wondering whether I can implement a button in the app that 'resets' the app to its initial status while generating a backup file with the data.kos– kos2012-03-11 12:29:26 +00:00Commented Mar 11, 2012 at 12:29
Add a comment
|
1 Answer
For backup File.Copy(source, destination) is sufficient. As for where, I'd say in the same location where your db is currently located. (I wouldn't recommend this though.) You will need to ship with the app a copy of the empty database that you copy over when a new user starts using the app. You need to figure out what's the identifier of each user (username, hash of their email address, etc..)
If you want to upload the database, then you can do it via a HttpWebRequest, or ftp/sftp (if you have libraries handy).
My opinion is that you need to:
- use 1 database
- partition data by user id
- each user gets to see his/her own data
- encrypt the database if you are storing sensitive data