HTTP状态码0-错误域= NSURLErrorDomain?

问题描述:

我正在研究一个iOS项目.

I am working on an iOS project.

在此应用程序中,我正在从服务器下载图像.

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

问题:

在下载图像时,我得到请求超时.根据文档,请求超时的HTTP状态代码为408.

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

但是在我的应用程序中,我收到HTTP状态代码0并显示以下错误

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

Error Domain = NSURLErrorDomain代码= -1001请求超时." 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 =请求超时. NSUnderlyingError = 0xx13846870请求超时."}

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

在搜索过程中,通过互联网,我没有找到有关HTTP状态码0的信息.

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

有人可以向我解释吗?

没有HTTP状态代码0.您看到的是所使用的API/库返回的0.您将需要检查文档.

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.