我使用Swift
和UIWebView
WebView.loadHTMLString(string, baseURL: nil)
并收到错误消息,
2019-05-08 13:52:58.758899 + 0800钱包[439:41398] [] nw_coretls_callback_handshake_message_block_invoke_3 tls_handshake_continue:[-9807] 2019-05-08 13:52:58.813981 + 0800 wallet [439:41413] NSURLSession / NSURLConnection HTTP加载失败(kCFStreamErrorDomainSSL,-9843)
和大多数类似的问题都使用URLRequest
,与我不同,
这是我的字符串
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Demo</title>
</head>
<body>
<form action="https://**.****.**.***:29843/Pay/order/Order.htm" method="post">
<input type="text" name="merchantName" value="net">
</form>
</body>
</html>
here I replace the ip address with *
override func viewDidLoad() {
super.viewDidLoad()
WebView.loadHTMLString(mystring, baseURL: nil) //mystring'value is above
WebView.delegate = self
}
func webViewDidFinishLoad(_ webView: UIWebView) {
webView.stringByEvaluatingJavaScript(from: "document.getElementById('frmBankID').submit(); ")
}
现在我的iphone是白屏的,我只想显示该页面,根本不在乎安全性,以任何方式获取该页面,谢谢
答案 0 :(得分:0)
根据Apple,您的主机名errSSLHostNameMismatch = -9843, /* peer host name mismatch */
出现了问题。您确定网址正确吗?真的是https吗?该域的SSL证书正确吗?
文档:https://opensource.apple.com/source/libsecurity_ssl/libsecurity_ssl-40581/lib/SecureTransport.h