ZipArchive
添加 libz.dylib
库
#import "Main.h"
- (void)zipToUnzip{
[Main unzipFileAtPath:@"/Users/admin/Desktop/zip/solozyx.zip"
toDestination:@"/Users/admin/Desktop/unzip/solozyx/"];
}
- (void)unzipToZip{
[Main createZipFileAtPath:@"/Users/admin/Desktop/zip/solozyx.zip"
withContentsOfDirectory:@"/Users/admin/Desktop/unzip/solozyx/"];
}
- (void)zip{
NSArray *paths = @[@"/Users/admin/Desktop/unzip/1.png",
@"/Users/admin/Desktop/unzip/2.png"];
[Main createZipFileAtPath:@"/Users/admin/Desktop/zip/png.zip"
withFilesAtPaths:paths];
}
SSZipArchive
#import <SSZipArchive.h>
[SSZipArchive createZipFileAtPath:<#(NSString *)#> withFilesAtPaths:<#(NSArray *)#>];
[SSZipArchive createZipFileAtPath:<#(NSString *)#> withContentsOfDirectory:<#(NSString *)#>];