NSURLErrorDomain error -3001

2019-07-28 23:43发布

I'm trying to download a file from the internet, but I get the error -3001 back. I've been searching through google but the error doesn't appear on any website, so i have no idea what it means.

Can anyone tell me what the error code "NSURLErrorDomain error -3001" means?

Thanks

标签: cocoa nserror
3条回答
聊天终结者
2楼-- · 2019-07-29 00:27

The error comes from the fact that setDestination expects a full path with a filename:

This is wrong:

[fileDl setDestination:@"/Users/ant/ebooks/" allowOverwrite:YES];

This is right:

[fileDl setDestination:@"/Users/ant/ebooks/file.epub" allowOverwrite:YES];

So the explanation is that probably you did something like I did: specify an existing folder where you intended to put the data.

PS: the dash before 3001 prevents Google from returning any results with the request: "NSURLErrorDomain error -3001", it is parsed as: "NSURLErrorDomain and error and not 3001"..

查看更多
唯我独甜
3楼-- · 2019-07-29 00:29

There's also a full list of all NSURL error codes here. It's very handy when you get cryptic error messages from the URL loading system.

查看更多
干净又极端
4楼-- · 2019-07-29 00:37

I wrote an applescript awhile back that can search the header files for error codes. You can find the applescript here.

I ran that applescript for your error code and got this from the CFNetworkError.h file.

Error Description: kCFURLErrorCannotOpenFile

查看更多
登录 后发表回答