2011-11-14 36 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框架。

相关问题