iOS11 WKWebview crash due to NSInvalidUnarchiveOperationException

Update for swift 5.0 ++ And Xcode- 11.5 +

If you faced this issue which I mentioned below after linked WKWebView in storyboard.

NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named WKWebView because no class named WKWebView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)

Just follow this instruction to solve this in new Xcode.

Here's a screen shot showing the project target's Build Phases when this is correctly configured:

enter image description here


Select Target -> General -> Linked framework and libraries -> click on + symbol below -> search for webKit.Framwork -> add.


Check whether on the storyboard you have a WKWebView instance while in code you may have a UIWebView instance


NSInvalidUnarchiveOperationException when loading the nib / storyboard means there an object in the nib / storyboard that the runtime doesn't understand. This is because the framework that defines that kind of object is missing.

So, in this case, you need to link your app target against the WebKit framework so that the app understands what a WKWebView is when it is decoded from the storyboard.

Here's a screen shot showing the app target's Build Phases when this is correctly configured:

enter image description here