iOS 10/UICollectionView: Uncaught exception: layout attributes for supplementary item at index path changed from to

时间:2016-10-19 13:34:18

标签: uicollectionview ios10

My app crashes when scrolling through a UICollectionView, but only under iOS 10:

Uncaught exception: layout attributes for supplementary item at index path
(<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0})
changed from <UICollectionViewLayoutAttributes: 0x6080001ec400>
index path: (<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0});
element kind: (UICollectionElementKindSectionHeader); frame = (0 8995; 414 180);
zIndex = 1024;  to <UICollectionViewLayoutAttributes: 0x6080001e8200>
index path: (<NSIndexPath: 0xc000000000000116> {length = 2, path = 1 - 0});
element kind: (UICollectionElementKindSectionHeader);
frame = (0 8994; 414 180); zIndex = 1024;  without invalidating the layout

I can fix this when I deactivate prefetching:

if ([self.collectionView respondsToSelector:@selector(setPrefetchingEnabled:)]) {
     self.collectionView.prefetchingEnabled = false;
}

but it seems as if this is a neat feature of iOS 10, so I would like to avoid that. I was looking for similar questions on SO, but they didn't help me, unfortunately, although this answer seems promising...

0 个答案:

没有答案