I'm running into the same issue. It doesn't happen if I just create a WKWebView. What triggers the crash is a call to evaluateJavaScript(_:in:in:completionHandler:) or callAsyncJavaScript(_:arguments:in:in:completionHandler:) on the web view, or their async counterparts. Here's a minimal reproducing example:
import SwiftUI
import WebKit
@main
struct LibswiftWebKitCrashApp: App {
var body: some Scene {
WindowGroup {
Text("Hello, world")
}
}
func thisIsNeverCalled() {
let webView = WKWebView()
webView.load(URLRequest(url: URL(string: "https://www.apple.com")!))
webView.callAsyncJavaScript("", in: nil, in: .page)
// webView.evaluateJavaScript("", in: nil, in: .page)
}
}
This shows "Hello, world" in an iOS 18.3.1 simulator, but crashes on launch in an iOS 18.4 or 18.5 (RC) simulator.
Environment: macOS 15.5 (24F74), Xcode 16.4 (16F6)
I'm going to file a Feedback later.
Topic:
Developer Tools & Services
SubTopic:
Xcode