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 Code=-1001 请求超时."用户信息=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=0x13846870 "请求超时."}

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.