核心数据存储(sqlite)备份的最佳实践?

Jas*_*son 2 sqlite iphone backup core-data

我正在为我的新iphone应用程序进行更新,其中包括备份和还原Core Data存储(SQLite)的功能.我一直在寻找如何做到这一点的好选择,但这方面的资源非常少.您在进行核心数据备份时发现了哪些最佳做法?我想保持配置尽可能简单,以便用户实际备份.众所周知,用户很少手动备份.如果可能的话,我希望它能自动化.

你发现什么是Core Data store(SQLite)备份的最佳实践?

Mar*_*rra 5

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.