核心数据存储(sqlite)备份的最佳实践?
我正在为我的新 iPhone 应用程序进行更新,其中包括备份和备份的功能。恢复核心数据存储 (SQLite)。我一直在寻找如何做到这一点的好选择,但关于这方面的资源很少。您发现进行核心数据备份的最佳实践是什么?我希望配置尽可能简单,以便用户真正进行备份。据我们所知,用户很少手动备份。如果可能的话,我希望它能够自动化。
您认为核心数据存储 (SQLite) 备份的最佳实践是什么?
I am working on an update for my new iphone app 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想进行备份,请将 sqlite 文件复制到另一个位置。如果您正在寻找更复杂的东西,请根据具体要求更新您的问题。
更新
一切。您可以与 DropBox API 集成并将文件复制到那里。您可以将更改推送到服务器上的 REST 服务,可以建立与 MobileMe 的连接并在那里推送副本,可以将其转换为 JSON 并将其推送到任何地方。您可以将其传真给某人。
您甚至可以设置可回溯至六个月的多文件备份策略:24 小时内每小时一次、7 天内每天一次、4 周内每周一次、永远每月一次。
如何备份是一个实施细节。 Core Data 足够开放,您可以将其转换为您想要的任何格式并将其推送到您想要的任何地方。这完全取决于你想投入多少努力以及你想把它放在哪里。
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
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.