Reputation: 81
I having an application which open the direction between two location in a webview using "http://maps.google.com" URL. but it is not working in iOS12. And also enabled the exceptional domain in App transport security plist value. Even though it is not working.
Upvotes: 1
Views: 1063
Reputation: 81
For me, the issue was caused by server trust check from the WKWebView.
To fix this I had to handle the challenge authentication callback and return a server trust credential.
Swift 4
func webView(_ webView: WKWebView,
didReceive challenge: URLAuthenticationChallenge,
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
{
if(challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust)
{
let cred = URLCredential(trust: challenge.protectionSpace.serverTrust!)
completionHandler(.useCredential, cred)
}
else
{
completionHandler(.performDefaultHandling, nil)
}
}
Upvotes: 0
Reputation: 2885
Please update your iOS 12 as the latest version asap.
iOS 12 beta
version has an issue of CORS with wkwebview.
And it has been fixed now.
Upvotes: 1