title: iOS 14 crash on UICollectionView FlowLayout
body: <p>Since the release of iOS 14 I'm facing an issue that I can't get my head around. It seems like it has something to do with UICollectionView FlowLayout. But the stacktrace does not point out on which viewcontroller the problem occurs. Can somebody give me some more insights?</p>
  <p>What I did so far was to make sure that the itemsizes I set on the flowlayouts are never negative and build some additional checks around it.</p>
  <pre><code>Fatal Exception: NSInternalInconsistencyException
  negative sizes are not supported in the flow layout
  
  
      Fatal Exception: NSInternalInconsistencyException
  0  CoreFoundation                 0x1905099d4 __exceptionPreprocess
  1  libobjc.A.dylib                0x1a3ebab54 objc_exception_throw
  2  CoreFoundation                 0x1904184fc -[CFPrefsSearchListSource addManagedSourceForIdentifier:user:]
  3  Foundation                     0x191710878 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
  4  UIKitCore                      0x192535be4 -[UICollectionViewFlowLayout _getSizingInfosWithExistingSizingDictionary:]
  5  UIKitCore                      0x192537068 -[UICollectionViewFlowLayout _fetchItemsInfoForRect:]
  6  UIKitCore                      0x192531040 -[UICollectionViewFlowLayout prepareLayout]
  7  UIKitCore                      0x19252ad4c -[UICollectionViewData _prepareToLoadData]
  8  UIKitCore                      0x19252d294 -[UICollectionViewData collectionViewContentRect]
  9  UIKitCore                      0x1924ebefc -[UICollectionView setFrame:]
  10 UIKitCore                      0x19325d8f4 -[UIView(Geometry) _resizeWithOldSuperviewSize:]
  11 UIKitCore                      0x193180eb8 -[UIScrollView(_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:]
  12 UIKitCore                      0x19325cb7c __46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke
  13 CoreFoundation                 0x19048d1c0 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
  14 CoreFoundation                 0x1903f1468 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]
  15 UIKitCore                      0x19325cad8 -[UIView(Geometry) resizeSubviewsWithOldSize:]
  16 UIKitCore                      0x19325afa0 -[UIView(Geometry) setFrame:]
  17 UIKitCore                      0x19325d8f4 -[UIView(Geometry) _resizeWithOldSuperviewSize:]
  18 UIKitCore                      0x19325cb7c __46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke
  19 CoreFoundation                 0x19048d1c0 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
  20 CoreFoundation                 0x1903f1468 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]
  21 UIKitCore                      0x19325cad8 -[UIView(Geometry) resizeSubviewsWithOldSize:]
  22 UIKitCore                      0x192f6c77c -[UITableView resizeSubviewsWithOldSize:]
  23 UIKitCore                      0x19325afa0 -[UIView(Geometry) setFrame:]
  24 UIKitCore                      0x1931ebc90 -[UIScrollView setFrame:]
  25 UIKitCore                      0x192f6ca50 -[UITableView setFrame:]
  26 UIKitCore                      0x19261b1b4 -[_UIQueuingScrollView _setWrappedViewAtIndex:withView:]
  27 UIKitCore                      0x19261bc08 -[_UIQueuingScrollView _viewAtIndex:loadingIfNecessary:updatingContents:animated:]
  28 UIKitCore                      0x19261ea9c __54-[_UIQueuingScrollView _didScrollWithAnimation:force:]_block_invoke
  29 UIKitCore                      0x19261e474 -[_UIQueuingScrollView _didScrollWithAnimation:force:]
  30 UIKitCore                      0x19261a9e8 -[_UIQueuingScrollView layoutSubviews]
  31 UIKitCore                      0x193277288 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
  32 QuartzCore                     0x19377ab2c -[CALayer layoutSublayers]
  33 QuartzCore                     0x193780ff8 CA::Layer::layout_if_needed(CA::Transaction*)
  34 QuartzCore                     0x19378c314 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
  35 QuartzCore                     0x1936d8570 CA::Context::commit_transaction(CA::Transaction*, double, double*)
  36 QuartzCore                     0x1937026f8 CA::Transaction::commit()
  37 QuartzCore                     0x1937039a8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
  38 CoreFoundation                 0x19048886c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
  39 CoreFoundation                 0x190482f40 __CFRunLoopDoObservers
  40 CoreFoundation                 0x190483488 __CFRunLoopRun
  41 CoreFoundation                 0x190482b90 CFRunLoopRunSpecific
  42 GraphicsServices               0x1a67a5598 GSEventRunModal
  43 UIKitCore                      0x192d6c638 -[UIApplication _run]
  44 UIKitCore                      0x192d71bb8 UIApplicationMain
  45 Smartschool                    0x104ff2244 main + 18 (main.m:18)
  46 libdyld.dylib                  0x190161588 start
  </code></pre>