views:

99

answers:

1

I'm using sqlite for the persistent store, so could I just upload the .sqlite file to, for example, Amazon S3 as a way of providing users with the ability to backup their app data? Then for restoring just download it back and replace the existing .sqlite file in the app's folder.

Does anybody see any issues with that? Has anyone done it? Any other suggestions on how to implement data backup feature?

+1  A: 

Yes, uploading the SQLite file is possible; it is just a file and can be backed up as you would for any file.

Generally though, this approach might be a little inflexible: it's an all or nothing approach to handling the data inside the .sqlite file.

If you wanted to provide finer grained backups, you might want to consider a solution for syncing the records in the database on the phone with records stored elsewhere. i.e. read all the objects you want to back up, convert them to JSON/XML/whatever and upload them to a server which then adds them to its own database.

The reason why you would export, send to a server and have the server import into its own database, is that this would allow you to perform more finegrained edits -- i.e. just sync the entries that have changed since last sync. However it is a lot more work since you will need to control the software running on the server and also have code to serialize your CoreData objects to the transfer format.

Matt Gallagher