What's the difference between UIWebView and WKWebView when loading local resources : <p>I want to load local resources with webView. I built a demo with both UIWebView and WKWebView to do some test with the code below.</p>

<pre><code>    let uiWebView = UIWebView(frame: self.view.bounds)
    self.view.addSubview(uiWebView)

    let wkWebView = WKWebView(frame:CGRect(x: 0, y: 400, width: 500, height: 500))
    self.view.addSubview(wkWebView)

    let path = Bundle.main.path(forResource:"1", ofType: "png")

    guard let realPath = path else {
        return
    }

    let url = URL(string: realPath)
    let fileUrl = URL(fileURLWithPath: realPath)

    if let realUrl = url {
        uiWebView.loadRequest(URLRequest(url:realUrl))
        wkWebView.load(URLRequest(url:realUrl))
    }


  // uiWebView.loadRequest(URLRequest(url:fileUrl))
  // wkWebView.load(URLRequest(url:fileUrl))
</code></pre>

<p>The uiWebView can load the resource but wkWebView can not. But if I use</p>

<pre><code>  uiWebView.loadRequest(URLRequest(url:fileUrl))
  wkWebView.load(URLRequest(url:fileUrl))
</code></pre>

<p>both uiWebView and wkWebView can work well.
I am confused and can anyone explain that for me:
Shouldn't I use URL(string: realPath) for a local resource? But why UIWebView can use it ? </p>
