File directory synchronization between server and iOS application

I am creating an internal iOS application (so it will never be in the application store), and I need to keep the content directory synchronized between the server and each instance of the iOS application. It would be simple enough if I just wanted to delete and re-download this content every time, but I would rather use something similar to rsync to load only those elements that have been changed.

I have not found a good way to use rsync. I saw Objective-Git as an opportunity here, but with a quick glance it looked like it still supports remote repositories that are not yet supported.

As a final note, while this will not be in the application store, I will not disassemble these devices, and I would prefer not to rely on any private API (although, if there was an elegant solution that used a private API, I could take it).

Thoughts?

ADDITIONAL NOTE: This must be an isolated solution. I will not rely on external services (e.g. Dropbox, Box.net, etc.). This should work exclusively between the device and the server (which is located in the local network with the device).

+7
source share
5 answers

Use HTTP to display the contents of each folder on the server. Compare the time of the last modification of each file with the data on the device and determine the added / deleted files. Get added and modified files, delete deleted files.

+3
source

It looks like you might ask for a library that already does this, but if you don't find it, then obviously it's easy to write it from scratch using stat (2) on the server and the same or higher level equivalent on iOS devices . Ask iPhone to send a tree of files with the date they were changed to the server and return a list of insert / delete / update operations that need to be done with the URL (or any other) for each of them so that you can do them in stages on a background thread. Have information from the server for new / updated files, including the modification date that the server has so that you can install it on your iOS device the same way and send it when the server asks for the status of each file (type of hack using the file system to save it, but it working).

+1
source

Why not just configure the RESTful interface and do it via HTTP; thus, you can request the modification time easily enough to determine if you need to update client or server files. You can also keep track of which files on the client are synchronized, so you can easily find out which files to add or delete. This can be done using a simple .sync file or using plist / sqlite / etc.

0
source

If you will consider FTP, there are some pretty advanced client libraries.

For example, iOS Chilkat bundle includes an FTP client library that supports synchronization in both directions. It's not free, but it's pretty cheap - and you get a ton of other things that are likely to be useful someday. Here is an iOS example that resets all additions and changes (mode 2):

http://www.example-code.com/ios/ftp_syncLocalTree.asp

One caveat - judging solely from the example, it does not synchronize deletions. If this is a requirement, you can do it yourself without much effort immediately after synchronization.

0
source

acrosync (see https://acrosync.com/library.html ) seems like a good help considering the original question, however I haven't used it myself yet.

0
source

All Articles