我正在使用 ASIHttpRequest。我需要知道这个错误信息是什么意思?我该如何解决
Request error <ASIHTTPRequest: 0xbedc00> -- Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0x270230 {NSUnderlyingError=0x250cf0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.)", NSLocalizedDescription=A connection failure occurred}
还有更多的错误信息;以上是Error Domain=ASIHTTPRequestErrorDomain Code=1
其他是Code=2
, Code=3
... upto Code=10
。我也需要这些吗?
编辑:
错误显示在 if 条件
SBJsonParser *p = [SBJsonParser new];
NSDictionary *content = [pobjectWithString:[request responseString]];
if(!content){
NSLog(@" %@", p.errorTrace);
return;
}
最佳答案
此错误表示无法联系主机,通常是因为您没有网络连接。
这是ASIHTTPRequest.h
中定义的错误代码
typedef enum _ASINetworkErrorType {
ASIConnectionFailureErrorType = 1,
ASIRequestTimedOutErrorType = 2,
ASIAuthenticationErrorType = 3,
ASIRequestCancelledErrorType = 4,
ASIUnableToCreateRequestErrorType = 5,
ASIInternalErrorWhileBuildingRequestType = 6,
ASIInternalErrorWhileApplyingCredentialsType = 7,
ASIFileManagementError = 8,
ASITooMuchRedirectionErrorType = 9,
ASIUnhandledExceptionError = 10,
ASICompressionError = 11
} ASINetworkErrorType;
关于iphone - ASIHTTPRequest 错误消息 - 初学者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9454609/