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 theUICollectionView
is outliving theDataSource
? - 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]