You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I open a local server for WKWebView. When I use http normally, but https, it is invalid to add a certificate. I use the certificate provided in demo.
But Xcode throw Error: WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, domain=NSURLErrorDomain, code=-1200
classViewController:UIViewController,WKNavigationDelegate{varserver:TelegraphServer!varwebView:WKWebView!overridefunc viewDidLoad(){
super.viewDidLoad()// Do any additional setup after loading the view.
server =TelegraphServer()
server.start()leturl=URL(string:"https://localhost:9000/")!
webView.load(URLRequest(url: url))
webView.allowsBackForwardNavigationGestures = true
}overridefunc loadView(){
webView =WKWebView()
webView.navigationDelegate =self
view = webView
}}classTelegraphServer:NSObject{func start(){// Comment out this line if you want HTTP instead of HTTPSloadCertificates()setupServer()}privatefunc loadCertificates(){// Load the P12 identity package from the bundle
if let identityURL =Bundle.main.url(forResource:"localhost", withExtension:"p12"){print("indentityUrl \(identityURL)");
identity =CertificateIdentity(p12URL: identityURL, passphrase:"test")}// Load the Certificate Authority certificate from the bundle
if let caCertificateURL =Bundle.main.url(forResource:"ca", withExtension:"der"){
caCertificate =Certificate(derURL: caCertificateURL)}// We want to override the default SSL handshake. We aren't using a trusted root// certificate authority and the hostname doesn't match the common name of the certificate.
if let caCertificate = caCertificate {
tlsPolicy =TLSPolicy(commonName:"localhost", certificates:[caCertificate])}}}
The text was updated successfully, but these errors were encountered:
Hi, sorry I haven't been really active in this project. Glad you found the solution.
Certificates can only be trusted if they have been issued by one of the trusted certificate authorities. Otherwise you need to explicitly trust the certificate on the client, like you did in your code.
I open a local server for WKWebView. When I use http normally, but https, it is invalid to add a certificate. I use the certificate provided in demo.
But Xcode throw Error:
WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, domain=NSURLErrorDomain, code=-1200
The text was updated successfully, but these errors were encountered: