I suggest you to use ssziparchive bcoz it support both ARC
and Non ARC
project.
- Add
SSZipArchive.h
, SSZipArchive.m
, and minizip
to your project.
- Add latest version of the
libz
(right now its libz1.2.5
) library to your target.
You don't need to do anything regarding ARC
. SSZipArchive
will detect if you're not using ARC
and add the required memory management code.
And code will be like this:
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
// Unzipping
//If your zip is in document directory than use this code
NSString *zipPath = [documentsDirectory stringByAppendingPathComponent:@"mediadata.zip"];
//else if zip file is in bundle than use this code
NSString *zipPath = [[NSBundle mainBundle] pathForResource:@"mediadata" ofType:@"zip"];
NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:@"MediaData"];
if( [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath] != NO ) {
//unzip data success
//do something
NSLog(@"Dilip Success");
}else{
NSLog(@"Dilip Error");
}