I’m working on an iOS app where I need to regularly “push” new levels to device. Level is a HTML5 page with images, javascript and css files. I need all level’s files to be cached locally before level can be played by a user. Each level is about 1.5MB. I’m thinking of archiving entire level’s folder with HTML, images, css and js into one zip archive, downloading this zip and then unarchiving it on device. But maybe it is more efficient to download each file separately, because they can be downloaded concurrently?
This is my first iOS app and I’m not really sure how to do it correctly. So the question is: what is the best way to asynchronously download an entire folder from a server and then trigger a callback when all files are downloaded (keeping in mind that user can close the app or lose connection in the middle of download)?
Since most users are actually on slow 3G connections, compressed archive downloads will be much faster (and cheaper for them) and will probably saturate their connection entirely. Doing it concurrently would just make all the transfers slower as they’re forced to share the same limited connection. Doing it in one go also avoids the headaches associated with one of the many transfers file transfer failing for example.