开发者

how to open HTTPS webservice in iPhone browser programmatically/

How to open the HTTPS web service in iPhone browser programmatically? I guess we can open the browser with the below syntax only for HTTP url,

开发者_StackOverflow NSURL *url = [NSURL URLWithString:@"http://www.iphonedevelopertips.com"];
[[UIApplication sharedApplication] openURL:url]; 

Can i use the same syntax to open it for HTTPS url also? when i tried, it terminated the application saying that "Service Untrusted Certificate"... How do i continue to further access the HTTPS web service??? Please help me

Thank You.


You could do it overriding allowsAnyHTTPSCertificateForHost: in the NSURLRequest class:

@implementation NSURLRequest(NSHTTPURLRequest)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
    return YES; 
}
@end

ugly but works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜