Post

Replies

Boosts

Views

Activity

Reply to iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
@DTS Engineer It looks like this issue will be fixed from the WebKit side here: https://github.com/WebKit/WebKit/commit/70e39a01ecebf7473ac1a3f4670b47f1222c65ce The issues still present in the iOS STScreenTimeConfigurationObserver though. Could it be documented or have a fatal error thrown on initialization of the queue is concurrent if that is possible. Future proof further instances?
Topic: UI Frameworks SubTopic: UIKit Tags:
Feb ’26
Reply to iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
What is happening This crash is happening because the update queue utilized for STScreenTimeConfigurationObserver in WebKit is concurrent instead of serial. See the highlighted line introduced in WebKit. How to fix (suggestions) a) The quick path is for WebKit to utilize the main queue or a private serial one instead of a global concurrent. b) Additionally the ScreenTime framework should either not allow concurrent queues to be utilized in STScreenTimeConfiugurationObserver.init(updateQueue:) or support concurrent queues. Why is this happening TL;DR [STScreenTimeConfigurationObserver setConfiguration:] is getting called multiple times at once and the KVO code is not thread safe. The Details The Automatic KVO implementation for STScreenTimeConfigurationObserver is not thread safe. While STScreenTimeConfiguration is. This issue can be reproduced by concurrently setting the private method [STScreenTimeConfigurationObserver setConfiguration: configuration] to a new configuration. In the implementation of STScreenTimeConfigurationObserver, the configuration is nil on setup. And the first callback from the underlying NSEXCConnection calls [STScreenTimeConfigurationObserver setConfiguration:]. Further updates call the private method [STScreenTimeConfigurationObserver _updateWithConfiguration:] which update the instance of STScreenTimeConfiguration directly where its kvo updates are thread safe. How to reproduce: // AppDelegate.swift let observer = MyObserver() observer.startObservation Swift 6.2 (approachable concurrency is turned off) MyObserver.txt Apologies about the escaped characters in the upload, a LLM can fix it pretty quick.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’26
Reply to iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
@DTS Engineer It looks like this issue will be fixed from the WebKit side here: https://github.com/WebKit/WebKit/commit/70e39a01ecebf7473ac1a3f4670b47f1222c65ce The issues still present in the iOS STScreenTimeConfigurationObserver though. Could it be documented or have a fatal error thrown on initialization of the queue is concurrent if that is possible. Future proof further instances?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
Filed under FB21862078
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
What is happening This crash is happening because the update queue utilized for STScreenTimeConfigurationObserver in WebKit is concurrent instead of serial. See the highlighted line introduced in WebKit. How to fix (suggestions) a) The quick path is for WebKit to utilize the main queue or a private serial one instead of a global concurrent. b) Additionally the ScreenTime framework should either not allow concurrent queues to be utilized in STScreenTimeConfiugurationObserver.init(updateQueue:) or support concurrent queues. Why is this happening TL;DR [STScreenTimeConfigurationObserver setConfiguration:] is getting called multiple times at once and the KVO code is not thread safe. The Details The Automatic KVO implementation for STScreenTimeConfigurationObserver is not thread safe. While STScreenTimeConfiguration is. This issue can be reproduced by concurrently setting the private method [STScreenTimeConfigurationObserver setConfiguration: configuration] to a new configuration. In the implementation of STScreenTimeConfigurationObserver, the configuration is nil on setup. And the first callback from the underlying NSEXCConnection calls [STScreenTimeConfigurationObserver setConfiguration:]. Further updates call the private method [STScreenTimeConfigurationObserver _updateWithConfiguration:] which update the instance of STScreenTimeConfiguration directly where its kvo updates are thread safe. How to reproduce: // AppDelegate.swift let observer = MyObserver() observer.startObservation Swift 6.2 (approachable concurrency is turned off) MyObserver.txt Apologies about the escaped characters in the upload, a LLM can fix it pretty quick.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’26
Reply to iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
Same with me as well, both present in iOS 26.1 and 26.2. One of our top ones at 1,473 crash events total. Our happens on an XPCConnection update.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’26