ASIHTTPRequest错误消息 – 初学者

我正在使用ASIHttpRequest。 我需要知道这个错误信息是什么意思? 我怎么解决呢

请求错误<ASIHTTPRequest:0xbedc00> – 错误域= ASIHTTPRequestErrorDomain代码= 1“发生连接失败”UserInfo = 0x270230 {NSUnderlyingError = 0x250cf0“操作无法完成(kCFErrorDomainCFNetwork错误2)”,NSLocalizedDescription =连接失败发生}

还有更多的错误信息; 以上是Error Domain=ASIHTTPRequestErrorDomain Code=1其他是Code=2Code=3Code=10 。 我需要这些也是什么?

编辑:错误显示在if condition

  SBJsonParser *p = [SBJsonParser new]; NSDictionary *content = [pobjectWithString:[request responseString]]; if(!content){ NSLog(@" %@", p.errorTrace); return; } 

此错误意味着主机无法联系,通常是因为您没有networking连接。

这里是在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; 

你应该尝试这样的事情

 -(void)requestFailed:(ASIHTTPRequest *)request{ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[request.error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alertView show]; }