简体   繁体   English

如何以编程方式在iPhone浏览器中打开HTTPS webservice /

[英]how to open HTTPS webservice in iPhone browser programmatically/

How to open the HTTPS web service in iPhone browser programmatically ? 如何以编程方式在iPhone浏览器中打开HTTPS Web服务? I guess we can open the browser with the below syntax only for HTTP url, 我想我们只能为HTTP网址使用以下语法打开浏览器,

 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? 我可以使用相同的语法为HTTPS URL打开它吗? when i tried, it terminated the application saying that "Service Untrusted Certificate"... How do i continue to further access the HTTPS web service??? 当我尝试时,它终止了应用程序说“服务不受信任的证书”...如何继续进一步访问HTTPS Web服务??? Please help me 请帮我

Thank You. 谢谢。

You could do it overriding allowsAnyHTTPSCertificateForHost: in the NSURLRequest class: 你可以在NSURLRequest类中重写allowAnyHTTPSCertificateForHost:

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

ugly but works. 丑陋但有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM