I've figured out a workaround, but still not entirely sure of the root cause.
The fix does, in fact, seem to be that a host app is required when using WKWebView in a unit test. However, it also seems to require loading or importing WebKit in the host app that is hosting the test.
If my host app is written in Swift, it requires an import WebKit or if my host app is written in Objective-C it requires importing WebKit but then also seems to require loading of WebKit by alloc'ing a WKWebView instance in the didFinishLoad of the AppDelegate. My issue was further complicated by using CocoaPods and its functionality to generate a host app if a test target requires it, but a workaround was found.
This behavior doesn't seem to be documented, and is maybe not even intended?
Topic:
Safari & Web
SubTopic:
General
Tags: