iOS 9:未设置UICollectionView数据源

自从iOS 9发布以来,crashalytics报告了来自NSInternalInconsistencyException: UICollectionView dataSource is not set的相当多的崩溃NSInternalInconsistencyException: UICollectionView dataSource is not set即使数据源被设置, NSInternalInconsistencyException: UICollectionView dataSource is not set数据源也没有设置。 感觉这可能是一个SDK错误,但我不知道如何避免它。

细节:

  • 这只发生在iOS 9上。在iOS 9上发生了数百次,在7/8上零次
  • 这发生在UIKit代码中的主线程上
  • 我设置的数据源,但它看起来像UICollectionView超出了数据源?
  • 没有一致的repro,但它根据crashalytics每天发生很多次。
主题:致命exception:NSInternalInconsistencyException
 0 CoreFoundation 0x181a91900 __exceptionPreprocess
 1 libobjc.A.dylib 0x1810fff80 objc_exception_throw
 2 CoreFoundation 0x181a917d0 + [NSException raise:format:]
 3基础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]