Self-sizing UICollectionViewCell crash in iOS 8/9

I am successfully using self-sizing UICollectionViewCells in iOS 10 and iOS 11. However, in iOS 9 I am receiving the following crash:

2017-11-20 10:57:15.527 [86301:3735747] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'

*** First throw call stack:

(

0 CoreFoundation 0x00000001140a8f65 __exceptionPreprocess + 165

1 libobjc.A.dylib 0x0000000112fb0deb objc_exception_throw + 48

2 CoreFoundation 0x0000000113f8ca94 -[__NSArrayM objectAtIndex:] + 212

3 UIKit 0x0000000116b09488 -[_UIFlowLayoutSection computeLayoutInRect:forSection:invalidating:] + 4625

4 UIKit 0x0000000116ab5b20 __56-[UICollectionViewFlowLayout _updateItemsLayoutForRect:]_block_invoke + 509

5 CoreFoundation 0x0000000113fd7ad2 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114

6 CoreFoundation 0x0000000113fd71c2 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 194

7 UIKit 0x0000000116ab5851 -[UICollectionViewFlowLayout _updateItemsLayoutForRect:] + 575

8 UIKit 0x0000000116ab5f2e -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] + 761

9 UIKit 0x0000000116ab1e1f -[UICollectionViewFlowLayout _layoutAttributesForItemsInRect:] + 515

10 UIKit 0x0000000116ab3582 -[UICollectionViewFlowLayout layoutAttributesForElementsInRect:] + 127

11 ..... 0x000000010f499e9a -[BaseCustomFlowLayout layoutAttributesForElementsInRect:] + 106

12 .... 0x000000010fa84212 _T05....24BaseSelfSizingFlowLayoutC27layoutAttributesForElementsSaySo016UICollectionViewfH0CGSgSC6CGRectV2in_tF + 242

13 .... 0x000000010fa8466f _T05....24BaseSelfSizingFlowLayoutC27layoutAttributesForElementsSaySo016UICollectionViewfH0CGSgSC6CGRectV2in_tFTo + 95

14 UIKit 0x0000000116ad17f4 __45-[UICollectionViewData validateLayoutInRect:]_block_invoke + 144

15 UIKit 0x0000000116ad1240 -[UICollectionViewData validateLayoutInRect:] + 3067

16 UIKit 0x0000000116a8183e -[UICollectionView layoutSubviews] + 196

17 UIKit 0x000000011632211c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710

18 QuartzCore 0x000000011542436a -[CALayer layoutSublayers] + 146

19 QuartzCore 0x0000000115418bd0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366

20 QuartzCore 0x0000000115418a4e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24

21 QuartzCore 0x000000011540d1d5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277

22 QuartzCore 0x000000011543a9f0 _ZN2CA11Transaction6commitEv + 508

23 QuartzCore 0x000000011543b154 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92

24 CoreFoundation 0x0000000113fd49d7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23

25 CoreFoundation 0x0000000113fd4947 __CFRunLoopDoObservers + 391

26 CoreFoundation 0x0000000113fca59b __CFRunLoopRun + 1147

27 CoreFoundation 0x0000000113fc9e98 CFRunLoopRunSpecific + 488

28 GraphicsServices 0x0000000119ff6ad2 GSEventRunModal + 161

29 UIKit 0x0000000116271676 UIApplicationMain + 171

30 .... 0x000000010f0bbfbf main + 95

31 libdyld.dylib 0x00000001161ae92d start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

Any ideas?

Self-sizing UICollectionViewCell crash in iOS 8/9
 
 
Q