[iOS 26.2] Crash due to WKScriptMessageHandler delegate

The crash is specific to iOS 26.2 prior versions working fine. WKScriptMessageHandler delegate func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)

Name attribute is accessible but WKScriptMessage body attribute causes crash

The object seems to be not accessible(not in memory)

self.webkit.configuration.userContentController.add(self, name: "sampleHandler")

self.webkit.load(request)

func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {

print(message.name) // works print(message.body) // crashes

}

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.

Bug Reporting: How and Why? has tips on creating your bug report.

[iOS 26.2] Crash due to WKScriptMessageHandler delegate
 
 
Q