Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 623 Vote(s) - 3.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File syncronization between iPhone and a server

#1
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 ?
Reply

#2
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.
Reply

#3
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:

1. Every time an object in the database is updated, the timestamp is recorded for that object.
2. A global, last updated timestamp is also updated.
2. The app contacts the webserver and asks for updates, passing along a locally stored "last updated" timestamp.
3. 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.)
4. The webserver then finds every object in the database whose timestamp is newer than the app's timestamp.
5. 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).
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through