iOS 9: UICollectionView Consistently Crashes Using estimatedItemSize

Originator:wetzeal
Number:rdar://25303115 Date Originated:22-Mar-2016 06:15 PM
Status:Duplicate/25379800/Closed Resolved:
Product:iOS Product Version:Xcode 7.3 (7D175)
Classification:Serious Bug Reproducible:Always
 
Summary:
Populating a UICollectionView with cells which have width and height calculated via AutoLayout can cause an infinite loop crash in UICollectionView _updateVisibleCellsNow:

Steps to Reproduce:
1. Create a UICollectionView with a single cell prototype
2. Constrain the cell prototype to be sized with AutoLayout based on some variable attribute (for instance a multiline UILabel)
3. Set a reasonable estimatedItemSize on the UICollectionViewFlowLayout
4. Provide input data which will cause some of the cells to wrap lines and become taller than others, and contains more items than fit on a single screen
5. Run on an iPhone simulator or device, scroll the collection view

Expected Results:
The collection view correctly sizes all of its cells based on their constraints

Actual Results:
The app crashes in an infinite loop inside _updateVisibleCellsNow:

Notes:
See attached project for a quick example with extremely minimal code. Example text from a prototype social media app. Simply build and run in an iPhone simulator and scroll down.

Comments

Wow, i accidentaly hit that bug when i prepared a minimal example-project for another bug o.O Duped it. estimatedItemSize seems totally broken.

By raise.rescue at April 18, 2016, 10:35 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!