WKWebView fails to load images and CSS using loadHTMLString(_, baseURL:)

前端 未结 10 830
抹茶落季
抹茶落季 2020-12-14 14:05

Apple\'s recommendation:

In apps that run in iOS 8 and later, use the WKWebView class instead of using UIWebView.

Thus, I have r

10条回答
  •  萌比男神i
    2020-12-14 14:43

    Try to create baseURL using:

    let baseURL = URL(fileURLWithPath: "#path#")

    instead of:

    let baseURL = URL(string: "#path#")

    The main difference is that the first method adds file:// prefix before the path.

提交回复
热议问题