I have kept my sqlite database in the S3 server in the .gz format. When my iOS App starts, I want to download the database in .gz file and decompress it in the documents directory.
Download part is working fine but decompression is not working.
I tried ZipArchive, but it doesn't decompress .gz file. It is able to unzip ZIP files. Below is the code, I tried.
ZipArchive *za = [[ZipArchive alloc] init];
if ([za UnzipOpenFile:filePath]) {
BOOL ret = [za UnzipFileTo:destPath overWrite:YES];
[za UnzipCloseFile];
[za release];
if (ret == YES) {
[self stopSpinner];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[appDelegate encTitle] message:@"Update successful.\nPlease restart the application for changes to take effect." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
} else {
//Didn't work
}
}
I found GZIP for decompression in iOS, but don't have any idea to use this. If anyone has idea, please share with me. Link for GZIP :: https://github.com/nicklockwood/GZIP
If anyone knows any other library for .gz decompression.....they are also welcome.