We were able to solve the problem with:
let configuration = WKWebViewConfiguration()
let contentController = WKUserContentController()
let script = WKUserScript(
source: #"window._platformProperties = {"os":"ios","capabilities":["brightness","contactInformation","location","push","share","storage","userRating"]}"#,
injectionTime: .atDocumentStart,
forMainFrameOnly: true
)
contentController.addUserScript(script)
configuration.userContentController = contentController
let webView = WKWebView(frame: .zero, configuration: configuration)
...more code
It was tricky to tackle, as in previous versions it worked when we called evaluateJavaScript() at any time.
With the changes in Xcode 13 / iOS 15 we tried calling it after webview.load(_ urlRequest: URLRequest), that still was to early.
We tried calling evaluateJavascript() in:
webView(_ webView: WKWebView, didFinish navigation: WKNavigation?)
That was too late.
The webview requires our "window._platformProperties" to be present in order to load.
Only after using a WKUserScript it works, as it is executed just at the right time.