2011-10-22 61 views
0

我正在嘗試使用ASIHTTPrequest。但是當我運行我的代碼時,出現以下錯誤消息。使用ASIHTTPRequest時發現錯誤

什麼錯在我的代碼,請幫助我,謝謝

域= ASIHTTPRequestErrorDomain代碼= 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

這不是特定於您的問題,可能實際上並沒有解決它,但是您應該在''viewDidLoad''方法中將'[super viewDidLoad]'放在頂部。你是否按照說明如何設置? http://allseeing-i.com/ASIHTTPRequest/Setup-instructions –

+0

這是否發生在模擬器和/或設備? – thomas

+0

看來你沒有互聯網連接(Open proxy)在代碼中調用該網站鏈接。如果您在系統Safari瀏覽器中打開代理,那麼它將在模擬器中工作。 – user198725878

回答

0

谷歌搜索錯誤消息變成了在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. 嘗試升級到最新的Git版本ASIHTTPRequest的具有一定修復在這一領域,並會忽略糟糕/無法訪問的PAC網址。
相關問題