美文网首页
https个人证书测试 WebView加载网页报错1202 9

https个人证书测试 WebView加载网页报错1202 9

作者: SunnyLeong | 来源:发表于2018-04-26 15:50 被阅读164次

import "MainViewController.h"

@interface DistributeViewController : MainViewController
@property (nonatomic,copy)NSNumber *companyID;
@property(nonatomic,copy)NSString *pathStr;

@end

@interface NSURLRequest (ForSSL)

  • (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host;

  • (void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString *)host;

@end

@implementation NSURLRequest (ForSSL)

  • (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host{
    return YES;
    }
  • (void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString *)host{

}

@end

创建WebView的地方:
[NSURLRequest allowsAnyHTTPSCertificateForHost:self.pathStr];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.pathStr]]];

相关文章

网友评论

      本文标题:https个人证书测试 WebView加载网页报错1202 9

      本文链接:https://www.haomeiwen.com/subject/wgqmlftx.html