Cannot run apps that use the callAsyncJavaScript() method on older simulators

If I use the method callAsyncJavaScript() my app will compile, but it won't run on older simulators.

Specifically, in a brand new Storyboard project, I added this to `viewDidLoad():

let webView = WKWebView()
webView.callAsyncJavaScript("1", in: nil, in: .page) { result in
print("\(result)")
}

This runs fine with Xcode 16.3 targeting the iOS 18.4 simulator. It doesn't work if I target the iOS 18.3.1 simulator or the iOS 17.5 simulator. It does work on an iPhone 15 Pro running iOS 18.4 and it works on an iPhone 12 Pro running iOS 17.7.1.

It goes without saying that this used to work on Xcode 16.2 and earlier, since my real project has been using that API for 3 or 4 years now.

The specific error is

dyld[89984]: Symbol not found: _$sSo9WKWebViewC6WebKitE19callAsyncJavaScript_9arguments2inAF17completionHandlerySS_SDySSypGSo11WKFrameInfoCSgSo14WKContentWorldCys6ResultOyyps5Error_pGcSgtF
Referenced from: <82CC68A8-9426-343E-82CD-5443F53A6919> /Users/dave/Library/Developer/CoreSimulator/Devices/69CE58A3-8162-4616-B110-5857E6E2889F/data/Containers/Bundle/Application/3F27AAA0-8E96-437D-A1F4-DECD2E1A95B5/CallAsyncJavascript.app/CallAsyncJavascript.debug.dylib
Expected in: <E11EC0F5-2AD1-3402-AB03-31A85EA6EB3A> /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebKit.framework/WebKit
Answered by DTS Engineer in 832442022

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software.

Please file a bug report that includes a Xcode project and some directions that can be used to reproduce the problem. And after that please post the bug number here. I'll check the status and provide an update (if there's anything to report) next time I do a sweep of forums posts where I've suggested bug reports.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software.

Please file a bug report that includes a Xcode project and some directions that can be used to reproduce the problem. And after that please post the bug number here. I'll check the status and provide an update (if there's anything to report) next time I do a sweep of forums posts where I've suggested bug reports.

Hello. The WKWebKit team says this is a known problem that only occurs in the simulator. To work around this problem, test your software on a real device instead of using the simulator.

If you do file a bug report, please continue to test your software in release and pre-release versions of system software made available to you through your developer.apple.com account. When you do, add details about that into your bug report to keep it up to date. Please see https://developer.apple.com/download/.

I'm seeing this in my project as well.

Cannot run apps that use the callAsyncJavaScript() method on older simulators
 
 
Q