Creating a Database Backup (via iTunes)
One method for backing up your database is to use the iTunes File Sharing feature. Follow these steps periodically to create a backup of your data just in case your device is lost or damaged.
- Connect your device to a Mac/PC running iTunes
- Click on the device in the left menu tree
- Then click on the “Apps” item in the upper menu bar
- Scroll down and you’ll see the File Sharing section
- Find either the Pain Tracker or Pain Tracker Lite icon (depending on which version you are using)
- You should now see the list of files in the app’s documents directory. This will include the database named “CPT_PrimaryDiary.sqlite”. This is the key file that you want to backup. Click on it to select it.
- Now click the Save To button and find a suitable storage spot on your Mac/PC.
- You’re done!
If you ever need to reload CPT, just reverse the process and copy the database from your Mac/PC back onto your device. Restart CPT and you’ll be back to the point of your backup.
Restoring the Database
If you switch devices or have to reinstall the CPT app, you may need to Restore one of your backed up database files (usually the last one you backed up). Doing so is very similar to the above instructions. But first, we need to make sure that CPT is fully closed before changing the database file. So follow these steps:
- Tap the device’s Home button to send CPT to the background
- Now double tap the device’s Home button to display the background apps bar at the bottom of the screen. You should see the Pain Tracker icon there.
- Tap/Hold on the CPT icon until you see the red circle with a “-” (minus sign) in it.
- Tap the red circle to fully close the app.
Now navigate through iTunes to the File Sharing screen just as you did during the backup procedure. The difference is that you will choose the “Add..” button in the iTunes File Sharing window.
Select the backup file you want to use and iTunes will copy that database to your device. You should now be able to restart CPT and your data will be restored.