2011-11-14 37 views
0

我必須從我的應用程序中的服務器加載所有必需的詳細信息。例如;我想從下面的URL加載國家詳細信息。HTTPS請求無法在iPhone設備上工作

https://sub.domain.com//members/phone/XML_list_countries.php

但我得到下面的錯誤。但是同樣的請求在模擬器中工作。

錯誤
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x3b8d10 {NSErrorFailingURLStringKey=https://secure.nymgo.com//members/softphone/XML_list_countries.php, NSErrorFailingURLKey=https://secure.nymgo.com//members/softphone/XML_list_countries.php, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x3b5090 "The request timed out."}

CODE

NSURL *url=[NSURL URLWithString:@"https://secure.nymgo.com//members/softphone/XML_list_countries.php"]; 
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 
[request setHTTPMethod:@"GET"]; 
NSURLConnection *_connection = [[NSURLConnection alloc] initWithRequest:_request delegate:self]; 
if(!_connection){ 
    NSLog(@"Can not make this request."); 
} 

我已經實現了所有必需的delegate方法。

注意:我的設備使用代理設置在Wifi中工作。

我不知道發生了什麼問題。請幫我解決這個問題。

+0

我檢查了HTTP請求,它在設備上工作正常,但HTTPS不工作。 – jfalexvijay

回答

0

我已經在不同的iPhone 3GiPhone 4設備上測試了相同的代碼。它工作正常。

注意:我在谷歌搜索很多。我得到了很多結果。其中一個結果就像是「有些iPhone 3G不支持HTTPS,所以我決定在不同的設備上進行測試,

0

你有沒有實現:

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; 

同時參閱this SO發佈。您也可以使用ASIHTTPRequest框架。

相關問題