title: Why does using headerReferenceSize with self-sizing cells in a collection view cause a crash in iOS 8?
body: <p>I managed to figure out <a href="https://github.com/fatuhoku/iOS-8-Self-Sizing-Collection-View-Cell-Demo" rel="noreferrer">the approach for self-sizing collection view cells under iOS 8</a>.</p>
  
  <p>I want to do this as a part of a accessory view.</p>
  
  <p>I get a crash ... the interesting part of the stacktrace is as follows:</p>
  
  <pre><code>** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
  *** First throw call stack:
  (
    0   CoreFoundation    __exceptionPreprocess + 165
    1   libobjc.A.dylib   objc_exception_throw + 45
    2   CoreFoundation    -[__NSArrayM insertObject:atIndex:] + 954
    3   UIKit             -[UICollectionViewFlowLayout layoutAttributesForElementsInRect:] + 384
    4   UIKit             __45-[UICollectionViewData validateLayoutInRect:]_block_invoke + 144
    5   UIKit             -[UICollectionViewData validateLayoutInRect:] + 1396
    6   UIKit             -[UICollectionView layoutSubviews] + 170
    7   UIKit             -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
    8   QuartzCore        -[CALayer layoutSublayers] + 150
    9   QuartzCore        _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    10  UIKit             -[UIView(Hierarchy) layoutBelowIfNeeded] + 611
    11  UIKit             -[UIInputSetHostView layoutIfNeeded] + 105
    12  UIKit             __43-[UIInputWindowController setInputViewSet:]_block_invoke + 112
    13  UIKit             +[UIView(Animation) performWithoutAnimation:] + 65
    14  UIKit             -[UIInputWindowController setInputViewSet:] + 291
    15  UIKit             -[UIInputWindowController performOperations:withAnimationStyle:] + 50
    16  UIKit             -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 1054
    17  UIKit             -[UIResponder becomeFirstResponder] + 468
    18  UIKit             -[UIView(Hierarchy) becomeFirstResponder] + 99
    19  UIKit             -[UITextView becomeFirstResponder] + 75
    ...
  </code></pre>
  
  <p>This looks like an Apple bug. Why does the layout seem to return an empty layout attribute?</p>