When referencing WebKit’s function callAsyncJavaScript, any iOS app crashes immediately on startup when running in simulator. On device, it does not crash.
The error message is:
dyld[9892]: Symbol not found: _$sSo9WKWebViewC6WebKitE19callAsyncJavaScript_9arguments2inAF17completionHandlerySS_SDySSypGSo11WKFrameInfoCSgSo14WKContentWorldCys6ResultOyyps5Error_pGcSgtF
Furthermore, this only happens for some simulators.
With Xcode 16.3, it’s simulators 18.0 and prior.
With Xcode 16.4 RC1 it includes simulators iOS 18.5 and 18.4 but works correctly on earlier versions of simulator.
The reproduction path is easy. Example file attached.
This used to work about 3 weeks or a month ago, which is perplexing.
As a workaround I replaced the function with evaluateJavaScript which does not crash, but that is not the desired method to use for us.
The attached file can reproduce it easily - just refernece this view from the default ContentView in a new project.