xyz qwerty
xyz qwerty

Reputation: 57

loadHTMLString is not loading images from a website

I'm loading part of the HTML content of a website onto a WKWebView. The part I'm trying to load sometimes contains an image. Using

webView.loadHTMLString(url, baseURL: nil)

gives me the following image:

The image is a screen shot of the WKWebView running a piece of the HTML (the HTML is coming from a website) on the simulator

Instead of the image being displayed a question mark is there. How do I fix this?

Upvotes: 1

Views: 1316

Answers (1)

matt
matt

Reputation: 535315

The problem is the baseURL: nil. You need to supply the actual base URL! Otherwise, how can the image URL be resolved?

Upvotes: 2

Related Questions