iOS Zip文件解压

it2023-08-22  67

iOS Zip文件解压

//zip文件解压 数据请求回来拿到 data 使用的解压类库 SSZipArchive NSString *path; NSString *zipPath; NSArray *pathes =NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES); //解压过后的存储路径 path= [pathes objectAtIndex:0]; //压缩文件存储的本地路径 zipPath= [path stringByAppendingPathComponent:@"temp.zip"]; [data writeToFile:zipPath options:0 error:nil]; [SSZipArchive unzipFileAtPath:zipPath toDestination:path]; NSString *htmlpath = [path stringByAppendingPathComponent:@"test.html"]; //转为String NSString *template = [NSString stringWithContentsOfFile:htmlpath encoding:NSUTF8StringEncoding error:nil]; NSLog(@"%@", template);
最新回复(0)