README and documentation[x] I have searched existing issues and this is not a duplicate
Library version(s): 1.0.0
The app will crash with:
IGListKitExamples[42894:733170] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Section controller nil for cell <IGListKitExamples.SearchCell: 0x7fd5bd41e2c0; baseClass = UICollectionViewCell; frame = (0 0; 320 44); hidden = YES; layer = <CALayer: 0x6000000396a0>>'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d37634b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010cdd721e objc_exception_throw + 48
2 CoreFoundation 0x000000010d37a442 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010c9a3d79 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 IGListKit 0x000000010c8153e8 -[IGListAdapter visibleSectionControllers] + 1320
5 IGListKit 0x000000010c819390 -[IGListAdapter scrollViewDidScroll:] + 192
6 UIKit 0x000000010e1f3afd -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 69
7 UIKit 0x000000010e1de525 -[UIScrollView setContentOffset:] + 478
8 UIKit 0x000000010e1ee06c -[UIScrollView _smoothScrollWithUpdateTime:] + 3141
9 QuartzCore 0x000000010de8ac35 _ZN2CA7Display15DisplayLinkItem8dispatchEy + 57
10 QuartzCore 0x000000010de8aaf5 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 449
11 CoreFoundation 0x000000010d308964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
12 CoreFoundation 0x000000010d3085f3 __CFRunLoopDoTimer + 1075
13 CoreFoundation 0x000000010d30817a __CFRunLoopDoTimers + 250
14 CoreFoundation 0x000000010d2fff01 __CFRunLoopRun + 2065
15 CoreFoundation 0x000000010d2ff494 CFRunLoopRunSpecific + 420
16 GraphicsServices 0x00000001115dba6f GSEventRunModal + 161
17 UIKit 0x000000010e109964 UIApplicationMain + 159
18 IGListKitExamples 0x000000010c6ecb6f main + 111
19 libdyld.dylib 0x000000011040968d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
the issue is easily reproducible by typing and scrolling at the same time.
Thanks @bonzoq ! 馃憤
Here's the assert that's firing:
Sounds like _cellSectionControllerMap is getting out of sync:
Nice find. I can get this to happen on the first try if I:
This does not happen on iOS 9.3. I have a feeling this is from iOS 10's UICollectionView cell willDisplay/didEndDisplay API changes. We break the cell -> section controller map that @jessesquires called out in collectionView:didEndDisplayingCell:forItemAtIndexPath:.
Wooooooooow. So on iOS 10, a cell can end up in -[UICollectionView visibleCells]before it calls collectionView:willDisplayCell:forItemAtIndexPath:. Crazy! This is probably radar worthy b/c a cell shouldn't be "visible" before the delegate is notified.
Now this only happens if you search, meaning that -[UICollectionView performBatchUpdates:completion:] is called. The search bar cell is never removed though.
I commented out the line -[IGListAdapter removeMapForCell:] and it doesn't crash anymore. However, if I follow the repro steps I see this:

Ok its to do with the UISearchBar remaining the first responder. This is both a bug in the sample app and a bug w/ UIKit.
Before OSS launch, there was no scrollDelegate for section controllers. We had a scroll method as part of the displayDelegate. After we split out scrolling to a new delegate, this silently broke the example. That means this code never executes!
I'm going to put up a PR that fixes this in the sample app. Probably worth filing a radar still though.
I have the same issue when I use displayDelegate and scroll the list so fast.
I dont't have a UISearchBar
@StormXX mind opening a separate issue w/ more information about your issue? This is over a year old.
Most helpful comment
Wooooooooow. So on iOS 10, a cell can end up in
-[UICollectionView visibleCells]before it callscollectionView:willDisplayCell:forItemAtIndexPath:. Crazy! This is probably radar worthy b/c a cell shouldn't be "visible" before the delegate is notified.Now this only happens if you search, meaning that
-[UICollectionView performBatchUpdates:completion:]is called. The search bar cell is never removed though.