Objective-Zip
Objective-Zip copied to clipboard
readCurrentFileInZipWithPassword now taking password
Hi I am trying to unzip password protected file. But it gives me expections here is my sample code
OZZipFile *unzipFile= [[OZZipFile alloc] initWithFileName:filePath mode:OZZipFileModeUnzip];
[unzipFile goToFirstFileInZip];
BOOL keepReading = YES;
@try {
while(keepReading){
OZFileInZipInfo *fInfo = [unzipFile getCurrentFileInZipInfo];
OZZipReadStream *readStream = [unzipFile readCurrentFileInZipWithPassword:@"password"];
NSMutableData *data = [[NSMutableData alloc] initWithLength:fInfo.length];
[readStream readDataWithBuffer:data];
[readStream finishedReading];
NSString* unzippedFilename = [self validFilePathForFilename:fInfo.name atPath:path];
[data writeToFile:unzippedFilename atomically:YES];
keepReading = [unzipFile goToNextFileInZip];
}
}
@catch (NSException *exception) {
NSLog(@"unzip file %@ failed:%@", filePath, exception.reason);
}
@finally {
[unzipFile close];
}
Can you please let me know whats problem
Were you able to solve this?