与Web服务器同步核心数据 [英] sync core data with web server
问题描述
我正在创建一个关于鸟类的应用程序。这个应用程序也应该在离线模式下工作。所以我决定使用Core Data。我计划有1个表,大约700记录。所有的鸟将以表视图显示。
工作流应该是这样:
- 用户启动应用程序
- User starts app
- Request is sent to server in background
- Response is parsed
- Database is updated
< b
我感兴趣的是什么是最好的方法做到这一点。我的观点是添加到请求最后修改字段,这将减少数据库应该更新的次数。我应该删除我的实体的所有实例,或者循环它们一个一个比较最后修改字段,然后更新/删除/插入?有没有人做时间剖析?
当用户在已删除旧实例并且未插入新实例的期间打开带有鸟的屏幕时,他将看到一个空表视图,如何处理这种情况,我需要一个tmp实体吗?
以下可能有帮助
http:// publication .csail.mit.edu / tmp / MIT-CSAIL-TR-2005-014.pdf
http://iphone2009.crowdvine.com/talk/presentation_file/5104/Grover_Syncing.pdf
http://stackoverflow.com/a/5052208/1294448
I'm creating an app about birds. This app should also work in offline mode. So I decided to use Core Data. I plan to have 1 table with approximately 700 records. All the birds will be displayed in a table view. Workflow should be like this:
I'm interested what's the best way to do this. My point is to add to the request "last modified" field, this will decrease the number of times database should be updated. Should I delete all instances of my entity, or loop them one by one comparing "last modified" field and then update/delete/insert ? Has anybody made time-profiling ? When user opens screen with birds in the period when old instances are already deleted and new are not inserted, he will see an empty table view, how to handle such situation, do I need a tmp entity ? Are there any other pitfalls I've missed ?
Following might be helpful
http://publications.csail.mit.edu/tmp/MIT-CSAIL-TR-2005-014.pdf
http://iphone2009.crowdvine.com/talk/presentation_file/5104/Grover_Syncing.pdf
http://stackoverflow.com/a/5052208/1294448
这篇关于与Web服务器同步核心数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!