iOS 9: UICollectionView DataSource is not set

百般思念 提交于 2019-12-07 01:42:34

问题


Since iOS 9 launched, Crashalytics has reported a fair number of crashes from NSInternalInconsistencyException:UICollectionViewdata source is not set even when the data source is set. It feels like it might be an SDK bug, but I have no idea how to avoid it.

Details:

  • This only happens on iOS 9. Hundreds of occurrences on iOS 9, zero on 7/8
  • This happens on the main thread, deep in UIKit code
  • I am setting the DataSource, but it looks like the UICollectionView is outliving the DataSource?
  • No consistent repro, but it happens many times a day according to Crashalytics.
Thread : Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x181a91900 __exceptionPreprocess
1  libobjc.A.dylib                0x1810fff80 objc_exception_throw
2  CoreFoundation                 0x181a917d0 +[NSException raise:format:]
3  Foundation                     0x18240499c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  UIKit                          0x1869152dc -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:]
5  UIKit                          0x1867e8990 -[UICollectionView _updateVisibleCellsNow:]
6  UIKit                          0x1867e389c -[UICollectionView layoutSubviews]

来源:https://stackoverflow.com/questions/35074706/ios-9-uicollectionview-datasource-is-not-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!