我想在我的 iphone 应用程序中包含一个 unrar 文件选项。
我已经尝试过https://github.com/ararog/Unrar4iOS但是这个库不完整(一些功能还没有实现,比如 -(BOOL) unrarFileTo:(NSString*)path overWrite:(BOOL)overwrite)
谢谢。
我最终使用了 Unrar4ios,但我需要自己编写实际提取 rar 文件的函数:
-(BOOL) unrarFileTo:(NSString*)path overWrite:(BOOL)overwrite {
int RHCode = 0, PFCode = 0;
[self _unrarOpenFile:filename mode:RAR_OM_EXTRACT];
while ((RHCode = RARReadHeaderEx(_rarFile, header)) == 0) {
if ((PFCode = RARProcessFile(_rarFile, RAR_EXTRACT, (char *)[path UTF8String], NULL)) != 0) {
[self _unrarCloseFile];
return NO;
}
}
[self _unrarCloseFile];
return YES;
}
这可能会有所帮助:https ://github.com/ararog/Unrar4iOS
unrarlib库应该适合你,因为 Objective C 是 C 的超集。