title: WKWeb View does finish loading of page in swift iOS?
body: <p>I have created a <strong>WKWebView</strong>. It loads the url of MSB ie. My school bucks. It loads almost all url for payment. But at one url <strong>didFinishLoad</strong> is not getting called. I have added all the delegates for the web view.but certainly it is not working. The whole process works fine in the web browser of iPhone.</p>
  
  <p>Below is the code I have added below code for that </p>
  
  <pre><code>let preferences = WKPreferences()
          preferences.javaScriptEnabled = true
          let configuration = WKWebViewConfiguration()
          configuration.preferences = preferences
          self.webView = WKWebView(frame: frame, configuration: configuration)
          self.view.addSubview(webView)
          self.webView.navigationDelegate = self
          self.webView.uiDelegate = self
  </code></pre>
  
  <p>Delegates Methods for the navigation </p>
  
  <pre><code>// MARK: - WKWebView Delegation
  extension PaymentWebViewController:WKNavigationDelegate {
  
      func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
          DILog.print(items: "didFinish")
          self.hideLoader()
          if let strUrl = webView.url?.absoluteString {
              self.readRedirectUrl(stringUrl: strUrl)
          }
      }
  
      func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
          DILog.print(items: "faluere")
          self.hideLoader()
      }
  
      func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
          DILog.print(items: "didStatrt")
          self.showLoader()
          if let strUrl = webView.url?.absoluteString {
              DILog.print(items: "URL IS \(strUrl)")
          }
      }
  
      func webView(_ webView: WKWebView,
                   didReceive challenge: URLAuthenticationChallenge,
                   completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -&gt; Void)
      {
          if(challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust)
          {        DILog.print(items: "Auth Channlenge1")
              let cred = URLCredential(trust: challenge.protectionSpace.serverTrust!)
              completionHandler(.useCredential, cred)
          }
          else
          {        DILog.print(items: "Auth Channlenge2")
              completionHandler(.performDefaultHandling, nil)
          }
      }
  
      func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
          DILog.print(items: "webViewWebContentProcessDidTerminate")
  
      }
  
      func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
          DILog.print(items: "didCommit")
  
      }
  
      func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -&gt; Void) {
          DILog.print(items: "decidePolicyFor Action")
          decisionHandler(WKNavigationActionPolicy.allow)
      }
  
      func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -&gt; Void) {
          DILog.print(items: "decidePolicyFor response ")
  
          decisionHandler(.allow)
      }
  }
  </code></pre>