(kCFStreamErrorDomainSSL,-9814) [英] (kCFStreamErrorDomainSSL, -9814)

查看:56
本文介绍了(kCFStreamErrorDomainSSL,-9814)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 webview 加载一个 php 脚本,但每次都出现错误.

I am trying to load a php script from a webview and am Having an error each and every time.

NSURLSession/NSURLConnection HTTP 加载失败(kCFStreamErrorDomainSSL,-9814)

我已经将 info.plist 更新为

I updated my info.plist already to

<key>NSAppTransportSecurity</key>
   <dict>
     <key>NSAllowsArbitraryLoads</key>
        <true/>
   </dict>

帮助我哪里出错了.

这是我的代码

func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
 let str : NSString = request.URL!.absoluteString  
 let url = NSURL(string: request.URL!.absoluteString)
 if (str.rangeOfString("https://testing.com/paymethod2.php").location != NSNotFound)
 { 
 }
 else
 {
     webView.stopLoading()
 }
 return true
}
func webViewDidFinishLoad(webView: UIWebView) {
let doc = webView.stringByEvaluatingJavaScriptFromString("document.documentElement.outerHTML") 
print(doc)
}

谢谢

推荐答案

9814 is errSSLCertExpired.更新您的证书.如果您使用的是一些自签名证书,并且确实希望它在过期后仍然有效,请阅读此文档:

9814 is errSSLCertExpired. Update your cert. If you're using some self-signed cert and you really want it to be valid in spite of being expired, read this doc:

https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html

这篇关于(kCFStreamErrorDomainSSL,-9814)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆