Can anyone suggest the best framework, method, library I could use in iPhone (use in development, not a ready application) in order to achieve syncronization between a fileserver and a local storadge on iPhone ?
2 Answers
I am doing this for one of my apps and the way I've implemented it is using a Ruby & Sinatra webserver, talking to a MongoDB database. You could use any other database and webserver technology.
The basic concept is this:
- Every time an object in the database is updated, the timestamp is recorded for that object.
- A global, last updated timestamp is also updated.
- The app contacts the webserver and asks for updates, passing along a locally stored "last updated" timestamp.
- The webserver processes the request by first checking the global timestamp and making sure it is older than the app's timestamp. (This is to save having to scour the database if no changes were made to it. My model is: Big data that is not changed frequently. If you have data that changes frequently, then there is probably no benefit to this global timestamp.)
- The webserver then finds every object in the database whose timestamp is newer than the app's timestamp.
- The webserver packages this up inside a JSON object, and returns it to the app.
This is all RESTful in the sense that it is a stateless transaction, so the app's implementation is very simple (a simple NSURLRequest, followed by JSON decoding, followed by error handling). Now you have an array of updated objects and you can merge these with your local storage in the app.
Another nice point about this (stateless) approach is that you can run it on Heroku (for free).

- 15,787
- 13
- 70
- 116
From what I can tell, there is no easy way. I was looking for an rsync equivalent, but I haven't found one.
In my case, I'm manually walking the tree asking the server for differences after a certain date and I remember the last successful sync date.
Not pretty. Could spend lots of time coming up with something sophisticated.

- 71,928
- 54
- 216
- 264
-
I was also hoping for something like rsync. – Cninroh Dec 01 '11 at 17:09
-
2then try this - http://stackoverflow.com/questions/5035132/how-to-sync-iphone-core-data-with-web-server-and-then-push-to-other-devices – Srikar Appalaraju Dec 01 '11 at 17:19
-
Srikar's link to another post is very helpful. – Flea Jun 29 '12 at 19:19