I'd like my app to decompress and handle the contents of zip files.
I'm trying to do this the Cocoa way, without using external libraries, so I'm turning to NSKeyedUnarchiver
and here's my code:
-(void) unarchive{
NSString *outputDirectory = [[NSHomeDirectory() stringByAppendingString:@"/Documents/"] stringByAppendingString:@"TheNewFolderName/"];
NSLog(@"Output Directory: %@", outputDirectory);
//MyArchive.zip is the filename of the zip file I placed in Xcode
NSData *theArchive = [NSKeyedUnarchiver unarchiveObjectWithFile:@"MyArchive.zip"];
NSError *error;
[theArchive writeToFile:outputDirectory options:NSDataWritingAtomic error:&error];
NSLog(@"theArchive is %@", theArchive);
And this prints "theArchive is null"! What am I doing wrong..?