iOS11 WKWebview crash due to NSInvalidUnarchiveOperationException
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:
Select Target -> General -> Linked framework and libraries -> click on + symbol below -> search for webKit.Framwork -> add.
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 instantiateclass named WKWebView because no class named WKWebView was found; theclass 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: