I am trying to unzip a file which is being downloaded through URL. The file downloaded is in zip format. I have used library : iPhone Unzip code which has SSZipArchive Library. It is used in current code to unzip the file once downloaded. But when I run the app as a stand alone application crashes by giving the log errors : example.app failed to launch in time. I am not sure if I can use this library or is there any other library which has been tried, tested and have it running on the device.
- (void)viewDidLoad {
[super viewDidLoad];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *directoryPath = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/ZipFiles.zip", directoryPath];
NSString* updateURL = @"http://www.example.com/test.php?id=11";
NSData* updateData = [NSData dataWithContentsOfURL: [NSURL URLWithString: updateURL] ];
[fileManager createFileAtPath:filePath contents:updateData attributes:nil];
/* SSZipArchive is a free API built on ZipArchive to unzip the files. Header file is passed in this class.*/
[SSZipArchive unzipFileAtPath:filePath toDestination:directoryPath];
NSLog(@"Finished unzipping database");
}