I'm working on an iPad app and I'm using ZipArchive to unzip files that I download. However, when I try to open the files, I find that the open method thinks I passed in a nil parameter.
NSString* filepath = [[[NSBundle mainBundle] pathForResource:@"help_me.zip" ofType:@"zip"] copy];
ZipArchive* zipArchive = [[ZipArchive alloc] init];
[zipArchive UnzipOpenFile:filepath Password:@"XYZ"];
In the 'UnzipOpenFile' method, the debugger says that 'filePath' is nil. I'm not sure why this happens. Any ideas why?
In
[[NSBundle mainBundle] pathForResource:@"help_me.zip" ofType:@"zip"]
you have specified the file extension twice, so that will return nil
(unless your file is called "help_me.zip.zip").
It should be
[[NSBundle mainBundle] pathForResource:@"help_me" ofType:@"zip"]
Btw., there is no need to copy
the file path.