iOS webview ssl 连接 (kCFStreamErrorDomainSSL, -9843)
<p><p>iOS9.3 xcode7.3.1
我想用 WebView 访问一个 HTTPS 站点,出现错误(kCFStreamErrorDomainSSL, -9843)</p>
<pre><code>NSMutableURLRequest* request = [ initWithURL:];
request.allowsCellularAccess = YES;
request.timeoutInterval = 7.0;
self.myWebview.delegate = self;
self.myWebview.scrollView.showsHorizontalScrollIndicator = NO;
self.myWebview.scrollView.showsVerticalScrollIndicator = NO;
self.myWebview.scrollView.backgroundColor = ;
;
</code></pre>
<p>当我意识到代理</p>
<pre><code>- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSString* str = request.URL.scheme;
if () {
if (isOK == NO) {
originrequest = request;
NSURLSessionConfiguration* con = ;
con.requestCachePolicy = NSURLRequestUseProtocolCachePolicy;
NSURLSession* urlsession = ];
task = [urlsession dataTaskWithRequest:request completionHandler:^(NSData* _Nullable data, NSURLResponse* _Nullable response, NSError* _Nullable error) {
NSString* str = [ initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"%@", str);
}];
;
;
return NO;
}
}
return YES;
}
</code></pre>
<p>我已经在 info.list 中添加了</p>
<pre><code><key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</code></pre>
<p>有没有什么办法可以用HTML在服务器上显示XX webView?
请帮帮我!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>试试这个</p>
<pre><code><key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>example.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>insecure.example.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</code></pre></p>
<p style="font-size: 20px;">关于iOS webview ssl 连接 (kCFStreamErrorDomainSSL, -9843),我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/38473596/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/38473596/
</a>
</p>
页:
[1]