A very useful library for Unarchiving the .zip, .rar, .7z files for iOS.
Simply An Integration of the following libraries :
Unrar4iOS : https://github.com/ararog/Unrar4iOS
SSZipArchive : https://github.com/soffes/ssziparchive
LZMA SDK (7z) : http://www.7-zip.org/sdk.html
优点
* Integration of the most popular archiving libraries, no need for integrating each library separately.
* Completely Block-based syntax. No Delegation pattern, hence avoiding a lot of clunky codes.
* 示例项目说明如何在在支持格式的存档文件(zip、rar、7z)上点击时,在设备的/simulator上的任何应用的“打开”操作表中显示您的应用程序。
* 示例说明了如何使应用程序支持iTunes文件共享。
缺点
* Have tested this only with smaller files. Might not suit well for files with larger
sizes ( May be files > 500MB's ).
* No support for passcode protected archive files.
说明
(i) Copy/Include the "External" folder into your project.
(ii) Copy/Include "Unrar4iOS.framework" & "libz.dylib" into your project.
(iii) Finally, Copy "SARUnArchiveANY.h" & "SARUnArchiveANY.m" into your project.
That's it. your done.
用法
SARUnArchiveANY *unarchive = [[SARUnArchiveANY alloc]initWithPath:filePath];
unarchive.destinationPath = destPath;//(Optional). If it is not given, then the file is unarchived in the same location of its archive file.
unarchive.completionBlock = ^(NSArray *filePaths){
NSLog(@"For Archive : %@",filePath);
for (NSString *filename in filePaths) {
NSLog(@"File: %@", filename);
}
};
unarchive.failureBlock = ^(){
};
[unarchive decompress];