0
我使用ZipArchive庫在我的iOS應用程序中解壓/壓縮文件。當密碼不正確時,UnzipOpenFile(ZipArchive)返回錯誤
我注意到,當密碼不正確時,UnzipOpenFile不會返回false。以下是來源。
有沒有人有類似的問題? (我已添加我的意見)
-(BOOL) UnzipOpenFile:(NSString*) zipFile
{
_unzFile = unzOpen((const char*)[zipFile UTF8String]);
if(_unzFile)
{
unz_global_info globalInfo = {0};
if(unzGetGlobalInfo(_unzFile, &globalInfo)==UNZ_OK)
{
//NSLog([NSString stringWithFormat:@"%ld entries in the zip file",globalInfo.number_entry]);
return true; // i have to add this myself here.
}
}
return _unzFile!=NULL;
}
-(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password
{
_password = password;
return [self UnzipOpenFile:zipFile];
}