2
蘋果託管內容正在下載爲.zip在應用程序內購買的情況下。 m試圖解壓縮這些內容,但提交以zipArchive打開.zip文件。解壓縮內容在應用程序內購買ios
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");
}
輸出
文件存在:....路徑.. 解壓無法打開文件
而是其工作正常,如果我捆綁的.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