So I went ahead and pushed another update out with my second attempt at avoiding the crash without having much to go on. This time I avoid accessing the visibleCells property on the table view all together. Now I hit a crash again that bubbles up to _createPreparedCellForRowAtIndexPath:willDisplay: but this time the crash report includes a bit more:
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
16 MyApp 0x104fcffa4 -[TableCellImageLoader didLoadImagesForCells] + 606116
--
Before the crash was triggered shortly after a reload data call on the table view when I accessed the visible cells property to determine the location of a "loading" cell. Now the crash is happening after my thumbnail loader loads some images and figures out the index paths needed to be reconfigured. The TableCellImageLoader uses indexPathsForVisibleRows to determine the index paths to reconfigure (it does not access the visibleCells property instead it looks through my model object using indexPathsForVisibleRows).
This crash report seems to imply that the crash may be related to the cell heights. My table view cells are self sizing (they override -systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority: and compute their size based on their content). My table view delegate does implement -tableView:estimatedHeightForRowAtIndexPath: (returning either a cached value or UITableViewAutomaticDimension) but I still don't really have a clue as to what the exception is about.
My delegate does not implement -tableView:heightForRowAtIndexPath: as the actual height is determined by the cell itself.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: