HTTP status code 0 - Error Domain=NSURLErrorDomain?

Irfan DANISH picture Irfan DANISH · Nov 8, 2013 · Viewed 290.6k times · Source

I am working on an iOS project.

In this application, I am downloading images from the server.

Problem:

While downloading images I am getting Request Timeout. According to documentation HTTP status code of request timeout is 408.

But in my application, I am getting HTTP status code 0 with the following error

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0xb9af710 {NSErrorFailingURLStringKey=http://xxxx.com/resources/p/PNG/1383906967_5621_63.jpg, NSErrorFailingURLKey=http://xxxx.com/resources/p/PNG/1383906967_5621_63.jpg, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x13846870 "The request timed out."}

During a search, over internet, I found no information about HTTP Status Code 0.

Can anyone explain this to me?

Answer

Julian Reschke picture Julian Reschke · Nov 8, 2013

There is no HTTP status code 0. What you see is a 0 returned by the API/library that you are using. You will have to check the documentation for that.