UICollectionViewCompositionalLayout section.decorationItems crash in iOS 16

Hi, I am using compositional layout on my UICollectionView. For my sections I have added a decorationItem which is a UICollectionReusableView.

Everything seems to work fine on all iOS versions, except iOS 16, where I'm getting an unexpected crash.

The Firebase Crashlytics report says as follows:

Fatal Exception: NSInternalInconsistencyException
Invalid parameter not satisfying: sectionIndex < self.solutionBookmarks.count

This happens right after I'm reloading my collectionView after fetching data from API.

Any help would be appreciated on this, since I can't seem to debug this issue whatsoever. Thanks

That exception is raised when compositional layout is queried for layout attributes for an item at an index path that is invalid.

Please file a feedback report at feedbackassistant.apple.com and post the Feedback ID here. Attach the full crash report, and your code that configures your compositional layout. That will hopefully provide a little more insight into the problem for us.

UICollectionViewCompositionalLayout section.decorationItems crash in iOS 16
 
 
Q