崩溃日止为: [UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 364
一般为
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
方法中出现了崩溃
**原因: **
1. 返回的cell为nil
查看有没有注册cell
2. 如果崩溃日志中 有[__NSCFArray count]
或者腾讯bugly中有-[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray
提示
- 查看
cellForItemAtIndexPath
方法中是否有数组越界的可能- 查看[collectionView reloadData] 的时机是否正确,可能数据源变化后,没有进行reloadData,如果这时候滑动列表页,就有可能会导致崩溃。
网友评论