Search code examples
iphoneiosipaddirectorymirroring

iOS - How to mirror a web directory locally ? (iCloud Like)


I'm trying to mirror a web directory in way that if a file is modified, it's gets modified locally. If it's removed, it gets removed from my iPad etc... iCloud works like that but I can't use iCloud for that. Do you know if there's a class in iOS I can use for that ?

The idea is to download the content once and then getting notification from the server every time a change is made.


Solution

  • For finding out if a modification has taken place, a HTML header-only request would tell you if something has changed - see the wiki entry on the HTTP etag for more.

    This header request would AFAIK have to be issued on each and every resource (file) you might be interested in.

    The eTag and its handling usually is happening transparently for you as a client developer. Frameworks like ASIHTTPRequest, AFNetworking and AFAIK even NSURLConnection handle this property by default when enabling caching - hence there is no need for you to handle/store the eTag yourself.