skip to Main Content

Our app works properly when debugging on Intel machines but it crashes when we run on MacBook Pro with M1.

App crash when we try to init WKWebView

enter image description here

setUpWebViewUI is called on main thread using DispatchQueue.main.async

What we tried

  • We have tried all common solutions (clean, derived data, Rosetta,
    etc..).
  • Some developers suggest changing schema settings but that
    also doesn’t work for us.
  • We tried other init methods of
    WKWebView but that also result in the same crash.

What works

One thing we found is that the app works properly if Xcode is not attached. If we run the app using the .app file in the Product folder then it works without any crash.

Version details:

macOS Version: 11.6.4.
Xcode Version: 13.2.1

Call Stack

#0  0x00000001972bbf50 in void JSC::LinkBuffer::copyCompactAndLinkCode<unsigned int>(JSC::MacroAssembler&, JSC::JITCompilationEffort) ()
#1  0x00000001972bb35c in JSC::LinkBuffer::linkCode(JSC::MacroAssembler&, JSC::JITCompilationEffort) ()
#2  0x0000000197908104 in JSC::LLInt::createJSGateThunk(void*, WTF::PtrTag, char const*) ()
#3  0x0000000196edec44 in JSC::LLInt::initialize() ()
#4  0x0000000197a9410c in void std::__1::__call_once_proxy<std::__1::tuple<JSC::initialize()::$_0&&> >(void*) ()
#5  0x000000018195d2b0 in std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*)) ()
#6  0x0000000197a90ac8 in JSC::initialize() ()
#7  0x000000019ca24fc0 in WebKit::runInitializationCode(void*) ()
#8  0x000000018195d2b0 in std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*)) ()
#9  0x000000019c80cafc in WebKit::InitializeWebKit2() ()
#10 0x000000019caeba84 in -[WKWebViewConfiguration init] ()
#11 0x000000019cae12b0 in -[WKWebView initWithFrame:] ()
#12 0x0000000104263428 in @nonobjc WKWebView.init() ()
#13 0x0000000104262350 in WKWebView.__allocating_init() ()
#14 0x000000010440c20c in AccountDetailViewController.setUpWebViewUI() at 

2

Answers


  1. I have the same problem. The only workaround that works for me is to run XCode under Rosetta (in /Applications open settings of XCode and set Rosetta checkbox) and then build and run app on target My mac (Rosetta)

    In this case all code will compile for x86_64 which doesn’t have the problem with WKWebView.

    Login or Signup to reply.
  2. Still same problem here, MacOS 13 and XCode 14.1.

    Just attaching an instance of WKWebKit into an NSWindow in IB makes the app crash right away when the window controller is loaded.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search