1

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

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
Pripyat
  • 2,937
  • 2
  • 35
  • 69

3 Answers3

6

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.

Alex
  • 26,829
  • 3
  • 55
  • 74
2

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"..

alecail
  • 3,993
  • 4
  • 33
  • 52
  • I'm getting this same error, but only on certain machines, not others, and am already specifying a full path including the filename. Any clue what could be a contributing factor? Do spaces in the file path, i.e. `.../Application Support/...` need to be escaped? – Jonathan Head Jul 10 '15 at 03:38
2

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

regulus6633
  • 18,848
  • 5
  • 41
  • 49