UITableview is now very unstable on iOS 16.2. I see nothing in the iOS release notes that documents any changes to UIKit in the minor updates (16.1 and 16.2) but I'm now getting periodic crashes every day (usually once or twice a day) in my own use of my app which I use extensively every day and have for a very long time. All the crashes start with a method call from my app to -reloadData or -reconfigureRowsAtIndexPaths:
and then stack trace looks like this:
Last Exception Backtrace:
0 CoreFoundation 0x1d1069e48 __exceptionPreprocess + 164
1 libobjc.A.dylib 0x1ca33b8d8 objc_exception_throw + 60
2 Foundation 0x1cb92a94c _userInfoForFileAndLine + 0
3 UIKitCore 0x1d3380888 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 572
4 UIKitCore 0x1d344eeb4 -[UITableView _createPreparedCellForRowAtIndexPath:willDisplay:] + 68
5 UIKitCore 0x1d344ea9c -[UITableView _heightForRowAtIndexPath:] + 124
6 UIKitCore 0x1d344e938 -[UISectionRowData heightForRow:inSection:canGuess:] + 176
7 UIKitCore 0x1d3681394 -[UITableViewRowData heightForRow:inSection:canGuess:adjustForReorderedRow:] + 228
8 UIKitCore 0x1d328e8c4 -[UITableViewRowData rectForRow:inSection:heightCanBeGuessed:] + 304
9 UIKitCore 0x1d368091c -[UITableViewRowData rectForGlobalRow:heightCanBeGuessed:] + 112
10 UIKitCore 0x1d3681f70 -[UITableViewRowData globalRowsInRect:canGuess:] + 468
11 UIKitCore 0x1d36b43b8 -[_UITableViewUpdateSupport _faultInRealHeightsOfNeededElements] + 96
12 UIKitCore 0x1d36ee6c8 -[_UITableViewUpdateSupport _setupAnimations] + 36
13 UIKitCore 0x1d3524154 -[UITableView _updateWithItems:updateSupport:] + 832
14 UIKitCore 0x1d34e7ff0 -[UITableView _endCellAnimationsWithContext:] + 9900
15 UIKitCore 0x1d40ac6fc -[UITableView reconfigureRowsAtIndexPaths:] + 352
This has severely damaged the quality of my app. I'm trying to mitigate these crashes by reducing/deferring my calls to mutate the table view but it seems essentially impossible because I can't tell the table view to do anything (reload, reconfigure, etc.) without risking one of these crashes. I'd open a TSI on this but I can't reproduce the issue in the debug environment and my project is very large (I can't reproduce in a simple sample obviously because I can' reproduce it in my real project when attached to the debugger). The crash happens usually after hours of daily use. Doesn't look like an invalid index path is being passed to the table view, especially considering that I get these crashes shortly after a call to -reloadData which is supposed to completely sync the table view to my data source.
I think someone with access to the UITableView source code can figure out what exception is being thrown here? I hope the changes made to UITableView will be reverted soon....
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: