gpt4 book ai didi

iphone - 处理报亭下载的内容

转载 作者:行者123 更新时间:2023-11-29 13:22:27 25 4
gpt4 key购买 nike

我想知道如何在 Newsstand 应用程序中访问从我的服务器下载的内容。我已经使用 NKAssetDownload 在缓存目录中成功下载了包含我的应用程序所有有用 Assets 的 zip 文件。我知道我们可以使用 ZipArchive 解压缩文件夹。但是为此我无法找到一种方法来访问下载的 zip 文件的路径。

目前路径是:

simulator -> Applications -> my_app_id -> Library -> Caches -> Newsstand ->(一些具有十六进制名称的文件夹)-> magazine.zip

ma​​gazine.zip 是我下载的文件。问题出在这个十六进制文件夹名称上。

现在我需要任何代码的帮助,这些代码可以解压缩此文件并在我的 imageView 的解压缩文件夹中使用 image.png。

这是我用过的代码:

NKLibrary *library = [NKLibrary sharedLibrary];

NKIssue *firstIssue = [library issueWithName:@"First Issue"];
firstIssue = [library addIssueWithName:@"First Issue" date:[NSDate date]];
NSURLRequest *urlReq = [NSURLRequest requestWithURL:[NSURL URLWithString:@"location of my zip file"]];
NKAssetDownload *asset = [firstIssue addAssetWithRequest:urlReq];

[asset downloadWithDelegate:self];

最佳答案

NKAssetDownload 采用委托(delegate),就像 NSURLConnection 一样。

您应该实现 NSURLConnectionDownloadDelegate 协议(protocol),并在方法 - (void)connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *)destinationURL 中传递 url到 zip

关于iphone - 处理报亭下载的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14068015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com