在应用内购买的情况下,苹果托管的内容将以.zip的形式下载.我试图解压缩这些内容,但提交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");
}
Run Code Online (Sandbox Code Playgroud)
输出是
文件存在:....路径..解压缩打开文件
相反,如果我捆绑一个.zip文件,它的工作正常
path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"module.zip"];
ZipArchive* za …Run Code Online (Sandbox Code Playgroud)