【问题标题】:xcode Unzip Downloaded issuexcode 解压下载的问题
【发布时间】:2012-02-13 14:11:36
【问题描述】:

我正在开发典型的报亭应用程序,但在解压缩下载的文件时遇到问题。

-(void)connectionDidFinishDownloading:(NSURLConnection *)连接destinationURL:(NSURL *)destinationURL {

//复制文件到目标目录

NSURL *finalURL = [[self contentURL] URLByAppendingPathComponent:@"magazine.zip"]; ELog(@"正在将项目从 %@ 复制到 %@",destinationURL,finalURL);

[[NSFileManager defaultManager] copyItemAtURL:destinationURL toURL:finalURL error:NULL]; [[NSFileManager defaultManager] removeItemAtURL:destinationURL error:NULL];

// 下载的文件 magazine.zip 现在在 finalURL 中,下一步我会尝试解压缩它

[SSZipArchive unzipFileAth:[finalURL path] toDestinan:[[self contentURL]path] overwrite:YES password:nil error:nil];

[self sendEndOfDownloadNotification]; }

然后什么也没有发生。我检查了文件是否真的位于 finalURL 路径,是的。 SSZipArchive 无法打开 magazine.zip 文件。我试图找到一些如何解压缩下载的报亭问题的示例,但我没有找到任何东西。

【问题讨论】:

    标签: xcode unzip newsstand-kit ssziparchive


    【解决方案1】:

    destinationURL 是您下载的 zip 文件的临时路径。您应该直接将文件从此处解压缩到目的地

        [SSZipArchive unzipFileAth:[destinationURL path] toDestination:[[self contentURL] URLByAppendingPathComponent:@"magazine.zip"] overwrite:YES password:nil error:nil]; 
    //Remove temp file
    [[NSFileManager defaultManager] removeItemAtURL:destinationURL error:NULL];
    

    【讨论】:

      猜你喜欢
      • 2023-01-11
      • 1970-01-01
      • 2021-12-29
      • 1970-01-01
      • 2011-03-13
      • 1970-01-01
      • 2012-09-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多