views:

40

answers:

1

Hello,

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,

 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.

A: 

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

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

ugly but works.

Jordi