objective-c 解压缩zip
1、首先引入libz.dylib框架
2、到http://code.google.com/p/ziparchive/downloads/list下载所需要的第三方文件,并将其导入到项目中。
3、解压缩ZIP文件代码如下:
#import "ZipArchive.h"
NSString *documentPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]; ZipArchive *zipArchive = [[[ZipArchive alloc]init]autorelease]; NSString *path = @"Lesson0"; NSString *filePath = [[NSBundle mainBundle]pathForResource:path ofType:@"zip"]; if ([zipArchive UnzipOpenFile:filePath]) { [zipArchive UnzipFileTo:documentPath overWrite:YES]; [zipArchive UnzipCloseFile]; }