I have a requirement where in i have to download a zipped files(basically contains web resource say HTML/JS/CSS files) from internet to iOS device using the iOS application and then display the content of the zipped file using the application. The starting point of the application will be index.html file.
Asked
Active
Viewed 979 times
0
-
So, what is your specific question? – sosborn Jul 31 '13 at 05:39
3 Answers
0
See this answer for decompressing the zip file (it uses an external library for decompression). Use UIWebView to display the HTML.

Community
- 1
- 1

isaach1000
- 1,819
- 1
- 13
- 18
0
Use ZipArchive to Unzip your files at some path
- (void)unzipFileAt:(NSString *)sourcePath toPath:(NSString *)destnPath{
ZipArchive *zipper = [[ZipArchive alloc]init];
if ([zipper UnzipOpenFile:sourcePath]) {
[zipper UnzipFileTo:destnPath overWrite:YES];
[zipper UnzipCloseFile];
}
}
Construct your path for index.html file like this,
NSString *filePath = [NSString stringWithFormat:@"%@/index.html",yourPathWhereTheFileWasUnzipped,pathComponent];
Load your UIWebView with the path variable.
self.html5View.scalesPageToFit = NO;
[self.html5View loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:filePath]]];
This works like a charm for me, for loading HTML5 files.

Satheesh
- 10,998
- 6
- 50
- 93
0
First you have to download the zip file from the server using library like ASIHTTP Then you have to unzip the zipped file using SSZipArchive to a specific folder in your Document folder Now just load a UIWebView with the NSURL made from the path of the index.html file inside the unzipped folder.

WakkaoW
- 54
- 1
- 7