我有一个UICollectionView和一个简单的UICollectionViewFlowLayout。在iOS 15上,当第一次加载视图和设置项时,会出现异常。
当设置项目时,在主线程上调用这一点:
var snapshot = NSDiffableDataSourceSnapshot<Section, PageItem>()
snapshot.appendSections([.main])
snapshot.appendItems(filteredPages)
dataSource.apply(snapshot, animatingDifferences: true)我得到了以下例外:
'the invalidation context ((null)) sent to -[UICollectionViewFlowLayout invalidateLayoutWithContext:] is not an instance of type UICollectionViewFlowLayoutInvalidationContext or a subclass'
terminating with uncaught exception of type NSException在iOS 14上运行相同的项目不会崩溃。
发布于 2022-01-27 13:44:55
问题在于激活了更改,因此从以下内容进行更改:
dataSource.apply(snapshot, animatingDifferences: true)至
dataSource.apply(snapshot, animatingDifferences: false)https://stackoverflow.com/questions/70064358
复制相似问题