-[UICollectionView _updateWithItems:tentativelyForReordering:] 中的 UICollectionView 断言失败

UICollectionView Assertion failure in -[UICollectionView _updateWithItems:tentativelyForReordering:]

iOS8.4.在设备上而不是模拟器上。

我收到这个 carsh 错误;

Assertion failure in -[UICollectionView _updateWithItems:tentativelyForReordering:], /SourceCache/UIKit/UIKit-3347.44.2/UICollectionView.m:4563

当我打电话时

NSArray* array_indexPaths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:0]];
[self.collectionView reloadItemsAtIndexPaths:indexPaths];

试过把上面的放进去 [self.collectionView performBatchUpdates:^{ 运气不好。

有没有其他人经历过这种情况或知道为什么会这样?

我找到了这个雷达:http://www.openradar.me/26280932 上面写着:

Calling insertItemsAtIndexPaths: on UICollectionView after viewDidLoad but before viewDidAppear: will cause an assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:]. Calling reloadData in the same scenario doesn't generate the assertion.

所以您可以在 viewDidAppear 和 adjust/wait 视图出现之前检查您是否正在打电话。