开发者

how to open HTTPS webservice in iPhone browser programmatically/

开发者 https://www.devze.com 2023-01-14 10:34 出处:网络
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,

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

精彩评论

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