使用ASIHTTPRequest时发现错误

时间:2011-10-22 10:39:20

标签: ios ios4 asihttprequest

我正在尝试使用ASIHTTPrequest。但是当我运行我的代码时,我收到以下错误消息。

我的代码中有任何错误请帮助我,谢谢

  

Domain = ASIHTTPRequestErrorDomain Code = 6“无法获取信息   在请求“UserInfo = 0x6043490”所需的代理服务器上   {NSLocalizedDescription =无法获取有关代理服务器的信息   请求所需}

以下是我的源代码

- (void)viewDidLoad {

  NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];

  ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];

  [request setDelegate:self];

  [request startSynchronous];   

  [super viewDidLoad];
}

- (void)requestFailed:(ASIHTTPRequest *)request
{
  NSLog(@"Error %@", [request error]);

  if ([request error])
  {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Fail." 
                 delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [alert show];

    [alert release];

     return;
  } 

}

1 个答案:

答案 0 :(得分:0)

Google搜索错误消息会在ASIHTTPRequest邮件列表中显示多个结果:

http://groups.google.com/group/asihttprequest/browse_thread/thread/924540472d721696/0dd6d853005631b0

http://groups.google.com/group/asihttprequest/browse_thread/thread/c15bcb756773685a

简而言之,似乎错误很可能与获取代理自动配置文件的问题有关。

所以:

  1. 检查设备上的网络设置,查看是否存在错误或无法访问的PAC URL
  2. 尝试升级到ASIHTTPRequest的最新git版本,该版本在此区域有一些修复,并会忽略错误/无法访问的PAC网址。