UIListContentConfiguration crashes the app with reason: 'Unknown style: 10'

My app won't start after I updated to Xcode 12 beta 4 and iPadOS beta 4. Instead it crashes immediately after launch. I assume that this is related to my sidebar (UIKit implementation) since UISplitViewControllers compact mode works.

The app crashes with the following errors:
  • Assertion failure in -[UIListContentConfiguration _enforcesMinimumHeight], UIListContentConfiguration.m:470

  • Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unknown style: 10'

I haven't been able to figure out what the root cause here is. The app used to work fine and still compiles without errors.

Any ideas what style 10 is?
According to @smileyborg on Twitter, this is a recently-introduced bug with 3-column split view controllers. The work-around is to create a new UIListContentConfiguration instead of using the cell's defaultContentConfiguration.

Code Block
UICollectionViewCellRegistration *cellRegistration = [UICollectionViewCellRegistration registrationWithCellClass:[UICollectionViewListCell class] configurationHandler:^(__kindof UICollectionViewListCell * _Nonnull cell, NSIndexPath * _Nonnull indexPath, id _Nonnull item) {
    // Populate the cell with our item description.
// UIListContentConfiguration *contentConfiguration = [cell defaultContentConfiguration];
    UIListContentConfiguration *contentConfiguration = [UIListContentConfiguration sidebarCellConfiguration];
    // ... Configure the configuration
    cell.contentConfiguration = contentConfiguration;
    cell.backgroundConfiguration = UIBackgroundConfiguration.clearConfiguration;
}];

This is a known issue in iOS 14 beta 4 and 5. The crash happens when you try to use the accompaniedSidebarCell or accompaniedSidebarSubtitleCell styles for UIListContentConfiguration that were added in iOS 14 beta 4. These styles are the default ones returned from the defaultContentConfiguration() method of a list cell inside a list with .sidebar appearance contained in the primary column of a .tripleColumn UISplitViewController.

Until this is fixed in the next beta, you can work around the crash by using UIListContentConfiguration.sidebarCell() instead, however make sure to remove that workaround once the underlying issue is fixed so that your cell content gets the correct styling.
This issue has been resolved in iOS 14 beta 6 released today. Please remove any workarounds and give it a try.
UIListContentConfiguration crashes the app with reason: 'Unknown style: 10'
 
 
Q