I received a question from a reader about the following errors using WKWebView in storyboard:
Could not instantiate the WKWebView class because no class named WKWebView was found; the class must be defined in the source code or linked from a library (make sure the class is part of the correct target)
He created a viewing controller with a
WKWebView using Interface Builder ( or storyboard) and connected it with code via an output variable like this:
@ IBOutlet var webView : WKWebView !
When you open the web view, the app will close and display the error above.
To fix the error, you just need to add the WebKit framework to your Xcode project. If you do not know how to manually add the frame, follow these procedures:
1. In the project navigator, select your project.
2. Then select the target and select the Construction Phase tab.
3. Under the Binary with libraries section, click the + button.
4. Enter WebKit, then add the WebKit framework.
That's it. Run the project again and you should be able to start the web view without the error.