Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files. I tried to unzip the file with SSZipArchive
and ZipArchive
, which are both based on minizip
.
When I compile the code, I get this error: Undefined symbols for architecture i386: "_OBJC_CLASS_$_ZipArchive", referenced from: objc-class-ref in AppDelegate.o
.
How do I unzip this file in iOS?
I've used ZipArchive with success in the past. It's pretty ligthweight and simple to use, supports password protection, multiple files inside a ZIP, as well as compress & decompress.
The basic usage is:
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"ZipFileName" ofType:@"zip"];
ZipArchive *zipArchive = [[ZipArchive alloc] init];
[zipArchive UnzipOpenFile:filepath Password:@"xxxxxx"];
[zipArchive UnzipFileTo:{pathToDirectory} overWrite:YES];
[zipArchive UnzipCloseFile];
[zipArchive release];
more examples about this package here
I have also tried SSZipArchive in some projects. Below line would unzip your zip file.
[SSZipArchive unzipFileAtPath:path toDestination:destination];