Download and unzip the file in the iOS application

advertisements

I've been looking around for hours trying to find a solution to my problem. My app uses roughly 25 html files to display content. I would like the app to go online (when started), check if there is an update and download a zip file that includes the 25 html files and overwrite the old ones. Been able to find bits and pieces, but nothing conclusive. Or i might just be slow..... Can anyone point me in the right direction, please? Thanks


Hi I have used ZipArchive in my couple of projects to unarchive the zip file and it is very fast and light weight. Here's a tutorial to learn: how to unzip file using ZipArchive.

To download the file from the server, you can use the following way:

    NSString *stringURL = @"http://webspace.apiit.edu.my/intake-timetable/download_timetable/timetableXML.zip";
    NSURL  *url = [NSURL URLWithString:stringURL];
    NSData *urlData = [NSData dataWithContentsOfURL:url];

There are lot of alternatives to download the files from the server, but this is the most common way to do it.