Question

I am trying to find a way to simply synchronise the files and folders from a web server to my iOS application but can't find a simple way to do this.

Basically, I have plist files in my [NSBundle mainBundle] and I need to be able to push updates to these, as well as be able to add and remove them. I would like to be able to just upload an identical file structure to a web server and have the application periodically check for changes, then synchronise changes if they have been made to the web server.

I was thinking something like rsync would be appropriate, however I wasn't sure if this would be best or how to implement it in the first place.

Thanks

Was it helpful?

Solution

This is often handled by copying any such files from the application bundle (read only) on first run to the documents folder, and always reading the files from the documents folder. (Hint: if they don't exist in the documents folder, copy them from the application bundle, then load.)

To update, simply download the new files, do any live updates required, then save over top the old files in the documents folder.

Create an update manifest file that your application downloads from your server that contains the file versions that are on the server and possibly the download URLs. This file can be a straight JSON formatted text file, even with a .json extension.

Check the version of the files in the documents folder and if the files in the manifest are newer, then download the updates.

This should get you started with the basic concept.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top