WEBKIT crash with Xcode 11.5 Fixed.


Just installed Xcode 11.5. Now I get a hard crash. No build errors. No runtime errors. Here's the error output.


2020-05-20 18:43:50.479256-0700 Web_Test[42330:11982154] *** Terminating app due to uncaught exception '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)'


Fixed the crash. Had to add WebKit.framework to Build Phases/Link Binary With Libraries.


Is this a bug with Xcode 11.5?

Replies

Had to add WebKit.framework to Build Phases/Link Binary With Libraries.

See this thread.

Is this a bug with Xcode 11.5?

That depends. The crash you were seeing is caused by UIKit trying to decode a nib that references

WKWebView
in a process where that class isn’t registered with the Objective-C runtime. That registration is based on whether you link to the WebKit framework. There are two ways this can happen:
  • Explicitly, as you’ve described above

  • Implicitly, based on your use of the framework

The implicit approach requires that you:

  • Set the Link Frameworks Automatically (

    CLANG_MODULES_AUTOLINK
    ) build setting
  • Set the Enable Modules (

    CLANG_ENABLE_MODULES
    ) build setting
  • Use C, Objective-C, or Swift (modules are not supported in C++)

  • Import the framework, for example, in Swift, with a line like this:

    import WebKit

    .

If you meet all of these requirements and you still see the problem, that’s definitely worth filing a bug about.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"