Load local web files & resources in WKWebView

后端 未结 4 2044
一向
一向 2020-11-30 00:57

Unlike with UIWebView and previous versions of WKWebView (iOS 10 & macOS 10.12), the default load operation for local files has moved from Bundle.main.path

4条回答
  •  醉酒成梦
    2020-11-30 01:55

    1, Open project setting and got to Build Phases tab, open Link Binary with Libraries. Add Webkit framework.

    2, Add the html to your project (Copy items if needed)

    3, add this to your code: @IBOutlet weak var webView: WKWebView!

    4, viewDidLoad viewDidLoad

提交回复
热议问题