Backup core data with RestKit 0.20

怎甘沉沦 提交于 2019-12-21 06:24:49

问题


I am fairly new to RestKit and in general with synching core data with a RESTful web service. To simplify this I have decided to use RestKit for only backing up the local store to our rails backend.

So here are two questions that are currently on top of my list:

1) What is the best practice for using RestKit to backup core data? I was thinking to create a local context that my apps uses to do all the fetch/create/update/delete operations (locally and persist them on the persistent store) Then in background allow RestKit via RKManagedObjectStore to do the backup using its own MOC every 5 minutes.

2) Does RestKit provides some handles methods to retry HTTP requests when offline? How do I manage situations such as a local CREATE and a local EDIT on the same entity? I was thinking to use Create/Update/Delete flags as suggested by Blake in one of his comments.

Thanks a lot for your help!


回答1:


Directly from Blake the creator of RestKit ! ​ Short answer: there is no ready solution for sync with RestKit (when offline) but Blake points at a small but very interesting starting point - if you have any other idea please feel free to suggest. I am still looking for the best way to do this.​

Blake Watters:

  1. I've never done anything like this before. In theory you should be able to just upload the SQLite, but I have no idea what kind of consistency guarantees you will have about the data.
  2. There is not any kind of built in mechanism for implementing this as its very hard to generalize syncing behaviors to this kind of level. RestKit gives you the low level components to implement something like this and there are some interesting open source efforts underway trying to tackle the problem: https://github.com/eric-horacek/EHObjectSyncManager


来源:https://stackoverflow.com/questions/16831580/backup-core-data-with-restkit-0-20

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!