We sometimes get crashes like these:
OS Version: iOS 16.3.1 (20D67)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Crashed Thread: 0
Application Specific Information:
_tintColorDidChange > dyld_v1 arm64e > tintColorDidChange
Thread 0 Crashed:
0 Sporfie 0x2032c5d80 [inlined] value
1 Sporfie 0x2032c5d80 ActionSheetCancelActionView.tintColorDidChange (ActionSheetCancelActionView.swift:25)
2 Sporfie 0x2032c5d9c ActionSheetCancelActionView.tintColorDidChange
3 UIKitCore 0x3219be460 -[UIView _tintColorDidChange]
4 UIKitCore 0x3219be9a8 -[_UIAccessibilityInterfaceStyleVisitor _visitView:]
5 UIKitCore 0x3219be064 _UIViewVisitorRecursivelyEntertainDescendingVisitors
6 UIKitCore 0x3219be10c _UIViewVisitorRecursivelyEntertainDescendingVisitors
7 UIKitCore 0x32197f278 _UIViewVisitorEntertainDescendingTrackingVisitors
8 UIKitCore 0x321a333c8 __45-[UIView _postMovedFromSuperview:]_block_invoke
9 UIKitCore 0x32299fd28 -[UIView _postMovedFromSuperview:]
10 UIKitCore 0x32197dfe8 -[UIView(Internal) _addSubview:positioned:relativeTo:]
11 Sporfie 0x2032c8c3c ActionSheetView.prepareLayout (ActionSheetView.swift:33)
12 Sporfie 0x2032bdfb8 AlertController.configureAlertView (AlertController.swift:327)
13 Sporfie 0x2032be130 [inlined] AlertController.viewDidLoad (AlertController.swift:256)
14 Sporfie 0x2032be130 AlertController.viewDidLoad (:253)
I'm suspecting that it is caused by tintColorDidChange() being called before buildView() is ever called and thus before visualStyle is set, so this line in tintColorDidChange() would cause a crash:
self.cancelLabel.textColor = self.visualStyle.textColor(for: self.action) ?? self.tintColor
because visualStyle is nil.
I unfortunately can't provide a recipe for replicating because it seems to happen randomly.
We sometimes get crashes like these:
OS Version: iOS 16.3.1 (20D67)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Crashed Thread: 0
Application Specific Information:
_tintColorDidChange > dyld_v1 arm64e > tintColorDidChange
Thread 0 Crashed:
0 Sporfie 0x2032c5d80 [inlined] value
1 Sporfie 0x2032c5d80 ActionSheetCancelActionView.tintColorDidChange (ActionSheetCancelActionView.swift:25)
2 Sporfie 0x2032c5d9c ActionSheetCancelActionView.tintColorDidChange
3 UIKitCore 0x3219be460 -[UIView _tintColorDidChange]
4 UIKitCore 0x3219be9a8 -[_UIAccessibilityInterfaceStyleVisitor _visitView:]
5 UIKitCore 0x3219be064 _UIViewVisitorRecursivelyEntertainDescendingVisitors
6 UIKitCore 0x3219be10c _UIViewVisitorRecursivelyEntertainDescendingVisitors
7 UIKitCore 0x32197f278 _UIViewVisitorEntertainDescendingTrackingVisitors
8 UIKitCore 0x321a333c8 __45-[UIView _postMovedFromSuperview:]_block_invoke
9 UIKitCore 0x32299fd28 -[UIView _postMovedFromSuperview:]
10 UIKitCore 0x32197dfe8 -[UIView(Internal) _addSubview:positioned:relativeTo:]
11 Sporfie 0x2032c8c3c ActionSheetView.prepareLayout (ActionSheetView.swift:33)
12 Sporfie 0x2032bdfb8 AlertController.configureAlertView (AlertController.swift:327)
13 Sporfie 0x2032be130 [inlined] AlertController.viewDidLoad (AlertController.swift:256)
14 Sporfie 0x2032be130 AlertController.viewDidLoad (:253)
I'm suspecting that it is caused by tintColorDidChange() being called before buildView() is ever called and thus before visualStyle is set, so this line in tintColorDidChange() would cause a crash:
self.cancelLabel.textColor = self.visualStyle.textColor(for: self.action) ?? self.tintColor
because visualStyle is nil.
I unfortunately can't provide a recipe for replicating because it seems to happen randomly.