Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UICollectionView Crash when using delegate publishers and UICollectionViewDiffableDataSource #53

Open
TheCoordinator opened this issue Aug 4, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@TheCoordinator
Copy link

Describe the bug
The UICollectionView crashes internally when using the delegate publishers such as didSelectItemPublisher and using UICollectionViewDiffableDataSource as dataSource.

To Reproduce

  1. Setup a collectionView with UICollectionViewDiffableDataSource as dataSource.
  2. Add an example publisher such as didSelectItemPublisher
  3. Update dataSource snapshot
  4. See crash log

Expected behavior
Shouldn't crash

Device:

  • OS: [e.g. iOS 14.5]
  • CombineCocoa 0.3.0

Additional context

Crash Log:

2021-08-04 11:21:52.800547+0100 App[6134:8095978] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000113473fba __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x0000000112bc1ff5 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001134f2523 _CFThrowFormattedException + 194
	3   CoreFoundation                      0x00000001134f0457 -[__NSArrayM insertObject:atIndex:].cold.2 + 0
	4   CoreFoundation                      0x000000011337114a -[__NSArrayM insertObject:atIndex:] + 1130
	5   Runtime                             0x000000010f64a5b8 unpackInvocation + 1410
	6   Runtime                             0x000000010f649fdd -[ObjcDelegateProxy forwardInvocation:] + 45
	7   CoreFoundation                      0x0000000113478259 ___forwarding___ + 825
	8   CoreFoundation                      0x000000011347a7a8 _CF_forwarding_prep_0 + 120
	9   UIKitCore                           0x000000012ddf07cd -[UICollectionView _notifyDidEndDisplayingCellIfNeeded:forIndexPath:] + 194
	10  UIKitCore                           0x000000012de07b5a -[UICollectionView _reuseCell:notifyDidEndDisplaying:] + 1471
	11  UIKit                               0x0000000150773878 -[UICollectionViewAccessibility _reuseCell:notifyDidEndDisplaying:] + 77
	12  UIKitCore                           0x000000012de17202 -[UICollectionView _updateAnimationDidStop:finished:context:] + 1838
	13  UIKitCore                           0x000000012de169e4 __102-[UICollectionView _updateWithItems:tentativelyForReordering:propertyAnimator:collectionViewAnimator:]_block_invoke.2110 + 77
	14  libdispatch.dylib                   0x0000000119698578 _dispatch_call_block_and_release + 12
	15  libdispatch.dylib                   0x000000011969974e _dispatch_client_callout + 8
	16  libdispatch.dylib                   0x00000001196a7b3f _dispatch_main_queue_callback_4CF + 1152
	17  CoreFoundation                      0x00000001133e18f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	18  CoreFoundation                      0x00000001133dc169 __CFRunLoopRun + 2781
	19  CoreFoundation                      0x00000001133db1a7 CFRunLoopRunSpecific + 567
	20  GraphicsServices                    0x0000000122ed0d85 GSEventRunModal + 139
	21  UIKitCore                           0x000000012e7184df -[UIApplication _run] + 912
	22  UIKitCore                           0x000000012e71d39c UIApplicationMain + 101
	23  libswiftUIKit.dylib                 0x0000000118266f42 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 98
	24  App                                0x000000010ef3c40a $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 122
	25  App                                0x000000010ef3c37c $s4App11AppDelegateC5$mainyyFZ + 28
	26  App                                0x000000010ef3c4f9 main + 41
	27  libdyld.dylib                       0x0000000119727bbd start + 1
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
terminating with uncaught exception of type NSException
@TheCoordinator TheCoordinator added the bug Something isn't working label Aug 4, 2021
@TheCoordinator TheCoordinator changed the title UICollectionViewDelegate.didSelectItemPublisher Crash UICollectionView Crash when using delegate publishers and UICollectionViewDiffableDataSource Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant