gpt4 book ai didi

objective-c - NSURL下载失败

转载 作者:行者123 更新时间:2023-12-03 17:38:47 24 4
gpt4 key购买 nike

我正在尝试在我的 cocoa 应用程序中下载文件,如下所示:

NSURLRequest *downloadRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:downloadURL]];
NSURLDownload *downloader = [[NSURLDownload alloc] initWithRequest:downloadRequest delegate:self];

其中 downloadURL 类似于 "https://www.abcd.com/path/to/file/abc.zip"

但是我在 (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error 方法中不断收到以下 NSError :

Error Domain=NSURLErrorDomain Code=-3001 "The operation couldn’t be completed. (NSURLErrorDomain error -3001.)" UserInfo=0x618000060a80 {NSErrorFailingURLStringKey=https://www.abcd.com/path/to/file/abc.zip, NSUnderlyingError=0x618000242010 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -3001.)", NSErrorFailingURLKey=https://www.abcd.com/path/to/file/abc.zip}

我做错了什么?

感谢您的帮助!

最佳答案

您收到的错误是 kCFURLErrorCannotOpenFile 。您可能需要手动捕获并处理 .zip 文件。

关于objective-c - NSURL下载失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27628527/

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