I am using objective-zip for zip/unzip files within folder. my folder contains multiple images, sqlite db file etc. This is the link from where i downloaded
and i got the code also for zip the folder This is the link of that
ziping of folder is done perfectly but i am not able to unzip that. here is my code.
-(void)makeUnZip{
NSString *stringPath1 = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
NSString *stringPath=[stringPath1 stringByAppendingPathComponent:[@"test" stringByAppendingFormat:@".zip"]];
ZipFile *unzipFile = [[ZipFile alloc] initWithFileName:stringPath mode:ZipFileModeUnzip];
NSArray *infos = [unzipFile listFileInZipInfos];
for (NSString *file in infos) {
ZipReadStream *readStream = [unzipFile readCurrentFileInZip];
FileInZipInfo *fileInfo = [unzipFile getCurrentFileInZipInfo];
NSString *fileName = [fileInfo name];
NSLog(@"File Name--- %@",fileName);
NSString *unzipFilePath = [stringPath1 stringByAppendingPathComponent:fileName];
NSString *dir = [unzipFilePath stringByDeletingLastPathComponent];
if (![[NSFileManager defaultManager] fileExistsAtPath:dir isDirectory:nil]) {
[[NSFileManager defaultManager] createDirectoryAtPath:dir attributes:nil];
NSLog(@"created directory %@", dir);
}
}
[unzipFile close];
}
This is link from where i got the reference for unzip
NSLog shows only one file name for all the file and my ziped file of document directory is not unziping.
For example my zip folder contains 3 images abc1.png, abc2.png and abc3.png then NSLog shows abc3.png for all 3 and it is not unziping.
When i am unzipping manually by going to simulator folder then it is showing all the images perfectly.
Can any one look in too it and let me know where I am wrong ?