开发者

Using Core Data as a storage for remote objects

I want to create gallery application which would get thumbnails and metadata from web using XML\JSON (it doesn't matter at this stage) and store t开发者_如何学JAVAhese images locally. I want to use Core Data for local storage, however I searched a lot and haven't found any simple solutions for syncing local data with remote server. What common patterns iOS developers use to solve this problem?

I need really simple functionality.

iOS app should be able to:

  1. download all new data from web server
  2. display full size image
  3. delete thumbnails from local storage if they were deleted from server

It's sounds simple but for me looks a bit difficult because generally there can be two conditions depending from whether user has connection to the internet or not. So for example I can't use upload date as a mark for "new" images. But I think this can be done with comparing ids or dates of latest images of the device and server.

Another point is that I can't control API of the server and don't want to write proxy server which would communicate directly with device. But how I could then check if image was deleted from server? Checking every thumbnail I have on the device would take a lot of time. I know, I can perform this check when user try to download full size image... But this doesn't seem to be good idea.

Are there any general patterns or methods or frameworks which would help with syncing data on iOS between web-service and device (Core Data)?


You definitely want to look at RestKit, on GitHub. Does exactly what you want and it's very awesome. I've been implementing it for a couple of weeks and I'm finding all kinds of uses for it. Very active google group too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜