(kCFStreamErrorDomainSSL, -9814)

北城余情 提交于 2020-01-23 12:54:18

问题


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

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9814)

I updated my info.plist already to

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

Help me where I am going wrong.

Here is the code that I have

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)
}

Thanks


回答1:


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




回答2:


This means the SSL Certificate has expired. If your SSL Certificate isn't expirted it could be caused by an incorrect Date Time set on your device.



来源:https://stackoverflow.com/questions/36569937/kcfstreamerrordomainssl-9814

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!