【问题标题】:Error found when using ASIHTTPRequest使用 ASIHTTPRequest 时发现错误
【发布时间】:2011-10-22 10:39:19
【问题描述】:

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

我的代码有任何问题,请帮助我,谢谢

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;
  } 

}

【问题讨论】:

  • 它不是特定于您的问题,可能无法真正解决它,但您应该将[super viewDidLoad] 放在viewDidLoad 方法的顶部。您是否按照有关如何设置的说明进行操作? allseeing-i.com/ASIHTTPRequest/Setup-instructions
  • 在模拟器和/或设备中会发生这种情况吗?
  • 您的代码中似乎没有互联网连接(打开代理)来调用该站点链接。如果您在系统 Safari 浏览器中打开了代理,那么它将在模拟器中运行。

标签: ios ios4 asihttprequest


【解决方案1】:

在 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 url。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-18
    • 1970-01-01
    • 2012-07-26
    • 2020-10-26
    • 1970-01-01
    • 1970-01-01
    • 2012-12-08
    相关资源
    最近更新 更多