SSZipArchive功能:
解壓zip文件
解壓密碼保護的zip文件
創(chuàng)建zip文件
追加到zip文件
壓縮文件
使用一個名字來壓縮NSData
使用前:
把SSZipArchive文件添加到項目中
在target中添加libz.dylib
// 解壓
NSString *zipPath = @"被解壓的文件路徑";
NSString *destinationPath = @"解壓到的目錄";
[SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath];
// 壓縮
NSString *zippedPath = @"壓縮文件路徑";
NSArray *inputPaths = [NSArray arrayWithObjects:
[[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"],
[[NSBundle mainBundle] pathForResource:@"photo2" ofType:@"jpg"]
nil nil];
[SSZipArchive createZipFileAtPath:zippedPath withFilesAtPaths:inputPaths];