I'm using the Objective-Zip to create a zip files, but it is not working and Xcode says that have many deprecation and issues. The first thing Is import all the classes inside the folders:
ARCHelper, ZLib, MiniZip, Objective-Zip
To my project, now I need to create a zip file, for this I use this code:
#import "ZipFile.h"
#import "ZipWriteStream.h"
- (void)viewDidLoad {
[super viewDidLoad];
NSString* str = @"teststring";
NSData* abcData = [str dataUsingEncoding:NSUTF8StringEncoding];
ZipFile *zipFile= [[ZipFile alloc] initWithFileName:@"test.zip"
mode:ZipFileModeCreate];
ZipWriteStream *stream = [zipFile writeFileInZipWithName:@"abc.txt"
compressionLevel:ZipCompressionLevelBest];
[stream writeData:abcData];
[stream finishedWriting];
[zipFile close];
}
When I build and run this code I receive the message:
*** Terminating app due to uncaught exception 'ZipException', reason: 'Can't open 'test.zip''
First, I create a zip file, not try to open him (So the message in console are wrong is 'can't create test.zip' not 'open').
Knowing about errors that are giving, I believe that this class of objective-zip is already old, I wonder if there is another class better than this in which I can create zip files (and set passwords for these files).