CSStickyHeaderFlowLayout: iOS 10 crash - Layout Attributes

Getting this crash when scrolling up in a UICollectionView section that has a sticky header:

layout attributes for supplementary item at index path (<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0}) changed from <CSStickyHeaderFlowLayout: 0x7fe26a858880> indexPath: {1, 0} zIndex: 1024 valid: YES kind: UICollectionElementKindSectionHeader to <CSStickyHeaderFlowLayout: 0x7fe26a85dd80> indexPath: {1, 0} zIndex: 1024 valid: YES kind: UICollectionElementKindSectionHeader without invalidating the layout

It seems like the header is switching incorrectly?

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 22 (4 by maintainers)

Most upvoted comments

Thanks @chrene! I’ve disabled prefetching in my UICollectionViewController like so:

override func viewDidLoad() {
    super.viewDidLoad()
    if #available(iOS 10.0, *) {
        self.collectionView?.isPrefetchingEnabled = false
    } else {
        //Fallback on earlier versions
    }
}

The crash is fixed with this update.

Getting this as well!

I have also written the library in swift and I’m planning on bumping the version in the near future. I don’t get the crash from the swift branch, BUT be careful about using that in production. It still needs a lot of testing 😃

I see, just updated to xcode 8 and running iOS 10 and it does crash. I saw a pull request that disables prefetching, but I’m trying to find a more robust fix. Basically as a workaround you can disable prefetching on your collection view to avoid the crash.

for me im experiencing the same error as mayanktiwari. However if anybody comes across this self.collectionView?.isPrefetchingEnabled = false did fix it for me though.

@jamztang any idea on this one? Seems to happen when scrolling back up.

I am facing the same exception when i try to scroll up my collectionView Programmatically … but this is only happening when i am running it on iOS 11 beta5 using Xcode 9 beta 2