Reputation: 101
I would like to export a ZIP file it is a sound file.
Then I would like to control this sound file using Push Notification.
When I load the sound file directly into Xcode it works. However, I export the file using a ZIP file it does not find the file?
As if he then does not find the file? What am I doing wrong?
I suspect the error is here: toDestination:@""
https://github.com/soffes/ssziparchive
- (IBAction)sound_ko:(id)sender {
//File check...
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *myFile = [mainBundle pathForResource: @"KO" ofType: @"zip"];
BOOL fileExists2 = [[NSFileManager defaultManager] fileExistsAtPath:myFile];
if (fileExists2 == NO){
NSLog(@"DOESNT Exist!");
} else {
NSLog(@"DOES Exist!");
}
//Unzip File
if( [SSZipArchive unzipFileAtPath:myFile toDestination:@""] != NO ) {
NSLog(@"Dilip Success");
}else{
NSLog(@"Dilip Error");
}
}
Upvotes: 0
Views: 2724
Reputation: 6934
There is a method that you can pass an error pointer to receive some more info in swift use this:
SSZipArchive.unzipFileAtPath(libAssetPath.path, toDestination: libSupportPath.path, overwrite: true, password: nil, error: &err, delegate: self)
if(err != nil){
print("\(err.debugDescription)")
}
Upvotes: 1
Reputation: 7
You should make sure to write on a writable location. Probably the best place to extract the file would be the Temp folder.
Upvotes: 0