views:

82

answers:

1

I am working on an update for my new iphone app (FlashCards++) which will include the ability to back up & restore the core data store (sqlite). I have been looking for good options for how to do this but there are very few resources about this. What are the best practices that you have found for doing core data backup? I'd like to keep the configuration as simple as possible so that users actually back up. As we know, users very rarely back up manually. I'd like it to be automated if possible.

What have you found to be best practices for core data store (sqlite) backup?

+2  A: 

If you just want to do a backup, copy the sqlite file to another location. If you are looking for something more complicated, please update your question with the specific requirements.

Update

What other sort of more complicated options are available? I haven't see anyone do much besides actually copying the sqlite file.

Everything. You can integrate with the DropBox API and copy the file there. You can push changes to a REST service on a server, you can build a connection to MobileMe and push a copy there, you can translate it to JSON and push it anywhere. You can fax it to someone.

You could even set up a multi-file backup strategy that goes back six months: hourly for 24 hours, daily for 7 days, weekly for 4 weeks and monthly forever.

How you back up is an implementation detail. Core Data is open enough that you can translate it into any format you want and push it anywhere you want. It all depends on how much effort you want to put into it and where do you want to go with it.

Marcus S. Zarra
What other sort of more complicated options are available? I haven't see anyone do much besides actually copying the sqlite file.
Jason
Jason
I would suggest picking a solution and testing it. Losing power or having the application quit in the middle of a file operation is pretty unlikely. I suspect you are over-thinking this problem.
Marcus S. Zarra