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

前端 未结 10 838
抹茶落季
抹茶落季 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条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 14:39

    Well you should be able to use local images and CSS files (and JavaScript files for that matter) with WKWebViews with the function that you have already found. My guess is that the problem is with your baseURL variable.

    Update 7.5.2017:

    I have completely updated the code from another SO answer of mine that used to be linked to my answer here. I have a working project for loadHTMLString() and .loadFileURL()

提交回复
热议问题