新人求罩。。。
xcode吧
全部回复
仅看楼主
level 1
吴叶希 楼主
苦逼工科女一枚,刚入手iOS开发,做一个简单的app,需要解压文件,用的是 objective-zip库,但是出了问题,我从 windows系统上接首到一个txt文件,然后再mac上用gbk编码格式可以打开,我再用mac上自带的压缩软件将这个txt文件压缩,然后用objective-zip库解压缩,发现解压出来的文件居然用gbk打不开,上网查了好久也解决不了,我的部分代码如下:
OZZipFile* zipFile=[[OZZipFile alloc]initWithFileName:zipFilePath mode:OZZipFileModeUnzip];
NSArray *infos= [zipFile listFileInZipInfos];
f ([info.name isEqual:fileName]||[info.name isEqual:fileName2]) {
OZZipReadStream *read= [zipFile readCurrentFileInZip];
NSLog(@"%@",info.name);
NSMutableData *data= [[NSMutableData alloc] initWithLength:info.length];
[read readDataWithBuffer:data];
if (![fileManager fileExistsAtPath:[unZipPath stringByAppendingFormat:@"%@%@",@"/",fileName]]) {
[fileManager createFileAtPath:[unZipPath stringByAppendingFormat:@"%@%@",@"/",fileName] contents:nil attributes:nil];
}
[data writeToFile:[unZipPath stringByAppendingFormat:@"%@%@",@"/",fileName] atomically:YES];
}
上面程序中,fileName就是我要解压的txt文件
2016年03月13日 09点03分 1
level 1
吴叶希 楼主
有没有大神能来解答一下啊,小女子感激不尽啊
2016年03月13日 12点03分 2
level 2
小白路过
2016年03月13日 13点03分 3
level 7
没看懂是什么意思
2016年03月17日 07点03分 4
1