I\'m trying to show in a WkWebView an html page that I previously downloaded and stored in a String.
This is how I setup my WkWebView:
webView =
SWIFT
You might be making it a bit too complicated. This worked for me ...
First, import WebKit
Second, create an @IBOutlet under your class:
@IBOutlet weak var webView: WKWebView!
Third, place the following in your viewDidLoad():
let htmlString:String! = "\(YourString)"
webView.loadHTMLString(htmlString, baseURL: NSBundle.mainBundle().bundleURL)
webView.loadHTMLString(htmlString, baseURL: Bundle.main.bundleURL)
I met the same problem as you! The key problem is in the project settings:
Check your Xcode Project > Target > Capabilities > App Sandbox.
Make sure you've CHECKED the NetWork ✅ Incoming & ✅ Outgoing connections.
See the SreenShot Below: