使用ZipArchive我使用下面的代码使用ZipArchive解压缩文件的文件:解压在iOS版SDK
NSString *zipDirectoryName = [sourceURL.lastPathComponent substringWithRange:NSMakeRange(0, sourceURL.lastPathComponent.length - sourceURL.pathExtension.length - 1)];
NSString *zipDirectoryPath = [documentDirectory stringByAppendingPathComponent:zipDirectoryName];
NSLog(@"Unzipping file at path %@", zipDirectoryPath);
success = [zip UnzipFileTo:zipDirectoryPath overWrite:YES];
if (!success) {
NSLog(@"Failed to unzip the zip file");
return;
}
else {
NSLog(@"Done");
}
,但我得到“无法解压缩zip文件”。无法弄清楚为什么文件没有被解压缩。任何帮助,将不胜感激
在此先感谢。从Here
请参考这个链接,请确保你遵循所有步骤正确。个人认为我们的代码应该工作: 'http://www.icodeblog.com/2012/08/13/unzipping-files-using-zip -archive /' 你用过这个:'ZipArchive * za = [[ZipArchive alloc] init]; ' – 2013-05-07 08:42:57
添加更多代码(如何打开存档)和“NSLog”输出将非常有帮助。 – Sulthan 2013-05-07 11:16:58