解压缩内容的应用程序内购买ios

苹果托pipe的内容正在下载作为.zip在应用程序内购买的情况下。 m试图解压缩这些内容,但提交zipArchive打开.zip文件。

ZipArchive* za = [[ZipArchive alloc] init]; za.delegate = self; NSString *path = [download.contentURL path]; if([[NSFileManager defaultManager] fileExistsAtPath:path]) { NSLog(@"File Exists: %@", path); } else { NSLog(@"file not exists: %@", path); } if( [za UnzipOpenFile:path] ) { if( [za UnzipFileTo:dir overWrite:YES] != NO ) { NSLog(@"unzip data success"); //unzip data success //do something } else { NSLog(@"unzip failed"); } [za UnzipCloseFile]; } else { NSLog(@"unzip can't open file"); } 

输出是

文件存在:….path..解压缩不能打开文件

相反,它工作正常,如果我捆绑一个.zip文件自己的

 path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"module.zip"]; ZipArchive* za = [[ZipArchive alloc] init]; za.delegate = self; if([[NSFileManager defaultManager] fileExistsAtPath:path]) { NSLog(@"File Exists: %@", path); } else { NSLog(@"file not exists: %@", path); } if( [za UnzipOpenFile:path] ) { if( [za UnzipFileTo:dir overWrite:YES] != NO ) { NSLog(@"unzip data success"); //unzip data success //do something } else { NSLog(@"unzip failed"); } [za UnzipCloseFile]; } else { NSLog(@"unzip can't open file"); } 

这里出来是

 File Exists: /var/mobile/Applications/B22970ED-D30A-460A-A0A1-C8458795C370/myApp.app/module.zip myApp[615:907] 63 entries in the zip file 2013-10-29 18:39:46.012 myApp[615:907] unzip data success 

不要试图解压缩包。 这只是一个文件夹。 您可以使用以下代码查看内容:

 NSArray *tempArrayForContentsOfDirectory =[[NSFileManager defaultManager] contentsOfDirectoryAtPath:[download.contentURL path] error:&error];