0

I've same issue as here : Strange behavior with WKWebView's loadHTMLString method. Images are not loading sometimes

I load html from a string who's have img tags targeting locals files. It's work fines in UIView but not in WKWebView (with same html string).

In safari debugger, i see thats they're no requests started for all imgs ressources !

The solution gived in the post quoted above doesn't work for me (i already had set the NSAppTransportSecurity.

I'm using Swift 2 / Xcode 7.2 / iOS 9.0

How can i do ?

Community
  • 1
  • 1
Khorwin
  • 445
  • 1
  • 9
  • 27
  • 1
    You can convert image in a Base64 string [Tutorial](http://stackoverflow.com/questions/11251340/convert-uiimage-to-base64-string-in-objective-c-and-swift) – xloug Mar 31 '16 at 15:15
  • Good alternative, it does the job, thanks! – Khorwin Apr 04 '16 at 08:29
  • You can't load images from the Documents folder into a WKWebView due to permissions. You either need to convert to Base64 or use images that are part of the projects bundle. – Scriptable Sep 19 '18 at 14:06
  • 1
    Possible duplicate of [Load local web files & resources in WKWebView](https://stackoverflow.com/questions/49638653/load-local-web-files-resources-in-wkwebview) – Scriptable Sep 19 '18 at 14:06

0 Answers0