title: WKWebView load request in device not working, but simulator is working
body: <p>I have a question about WKWebview.<br>
  First, I have a UITabbarViewController(tab1, tab2), and two ViewControllers.<br>
  In ViewController1 have two button (button1, button2) which action is click the tabbar tab2 to present the ViewController2 and bring different url string.<br>
  In ViewController2 have a WKWebView, and load the request of url string.<br>
  I work fine in simulator, but build in device and work fine at first time and the then I tap the tabbar tab1 and back to ViewController1.<br>
  I click the button2 and present the ViewController2.<br>
  And I also set breakpoint, the WKWebview have run the load request function.<br>
  But the WKWebview also show me the button1 url content, not button2 url content. When I back and click button2 again, it's work. Why the WKWebView don't refresh at first time?<br> 
  Thanks. <br>
  Xcode 9.4.1, device iOS 12.0.1(16A404)</p>
  
  <pre><code>class ViewController1: UIViewController {
  
  @objc func btnTapped(sender: UIButton) {
  
      if let vc = self.navigationController?.parent as? ViewController {
          if let number = item?.number {
  
              let domainPath = “\(customURL!.absoluteString)"
              let extPath = "detail/\(number)/&amp;topPageBack=list"
              let encodestr = extPath.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
              let finalPath = domainPath.appending("/").appending(encodestr!)
  
              if let url = URL(string: finalPath) {
                  vc.loadSpecificURL = url
              }
              vc.tabBarView.buttonClick(tag: 1)
          }
      }
  }
  }
  </code></pre>
  
  <p><br></p>
  
  <pre><code>class ViewController2: UIViewController {
  
  lazy var webViewController: CustomWKWebViewController = {
      let controller = CustomWKWebViewController()
      controller.wKWebViewPage = .searchPage
      return controller
  }()
  
  var loadURL: URL?
  
  override func viewWillAppear(_ animated: Bool) {
      super.viewWillAppear(animated)
      if let url = loadURL {
          webViewController.reloadWebView(url: url)
          loadURL = nil
      }
  
  }
  
  }
  </code></pre>
  
  <p><br></p>
  
  <pre><code>class CustomWKWebViewController: UIViewController {
  
  private func settingWebView() -&gt; WKWebView {
      let userScript = WKUserScript(source: source, injectionTime: .atDocumentStart, forMainFrameOnly: true)
  
      let userContentController = WKUserContentController()
      userContentController.add(self, name: "Login")  
      userContentController.add(self, name: "Other")
      userContentController.add(self, name: “LD”)
      userContentController.addUserScript(userScript)                     
  
      let config = WKWebViewConfiguration()                   
      config.userContentController = userContentController
  
      webView = WKWebView(frame: .zero, configuration: config)
      webView!.navigationDelegate = self
      webView!.uiDelegate = self
      webView!.scrollView.bounces = false
      webView!.allowsBackForwardNavigationGestures = true
      webView!.backgroundColor = .clear
      webView!.scrollView.backgroundColor = .clear
  
      if let request = getRequest() {
          webView!.load(request)
      }
      return webView!
  }
  
  func reloadWebView(url: URL?) {
  
      if let url = url, let webView = self.webView {
          var requestForBlank = URLRequest(url: URL(string: "about:blank")!, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 3)
          requestForBlank.httpMethod = "POST"
  
          var request = URLRequest(url: url, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 3)
          request.httpMethod = "POST"
  
          webView.load(requestForBlank)
          webView.load(request)//breakpoint always break here, but the view don't load request.
      }
  }
  
  }
  </code></pre>