我正在尝试从一个webview加载一个php脚本,并且每次都有一个错误。
NSURLSession/NSURLSession负载失败(kCFStreamErrorDomainSSL,-9814)
我已经更新了我的info.plist
<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)
}谢谢
发布于 2016-05-01 07:20:18
9814是errSSLCertExpired。更新你的证书。如果您正在使用某种自签名证书,并且确实希望它在过期后仍然有效,请阅读以下文档:
发布于 2019-08-20 06:22:38
这意味着SSL证书已过期。如果SSL证书未到期,则可能是由于设备上设置的日期时间不正确造成的。
https://stackoverflow.com/questions/36569937
复制相似问题