首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

应用ZipArchive解压

2013-02-19 
使用ZipArchive解压NSString *path [NSHomeDirectory() stringByAppendingPathComponent:@Documents]

使用ZipArchive解压
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];//设置ZIP文件路径NSString *filePath = [path stringByAppendingPathComponent:@"book.zip"];//设置解压文件夹的路径NSString *unZipPath = [path stringByAppendingPathComponent:@"books"];//初始化ZipArchiveZipArchive *zip = [[ZipArchive alloc] init];BOOL result;if ([zip UnzipOpenFile:filePath]) { //解压文件 result = [zip UnzipFileTo:unZipPath overWrite:YES]; if (!result) { //解压失败 NSLog(@"unzip fail"); }else { //解压成功 NSLog(@"unzip success"); } [zip UnzipCloseFile];//关闭}[zip release];

?

热点排行