[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFo...

崩溃日志为: [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提示

  1. 查看cellForItemAtIndexPath方法中是否有数组越界的可能
  2. 查看[collectionView reloadData] 的时机是否正确,可能数据源变化后,没有进行reloadData,如果这时候滑动列表页,就有可能会导致崩溃。
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容