-
Notifications
You must be signed in to change notification settings - Fork 328
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
iOS 9 crash #94
Comments
I'm experiencing a similar problem. Any time the collection view is scrolled, the following crash occurs: *** Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3505.4/UICollectionView.m:4211 As macsrok said, the exception occurs in invalidateLayoutIfNecessary:, upon the performBatchUpdates:, because previousIndexPath is nil |
@PeymanKh I did not try the example project until now, and it seems to be fine as well. However, in my app, in a very similar way, crashes in iOS9 beta 5, as I reported, whenever I try to scroll |
and btw, My crash is different from the one reported by @macsrok because I check if previousIndexPath is nil before doing [strongSelf.collectionView deleteItemsAtIndexPaths:@[ previousIndexPath ]]; |
Further information about this problem: I debugged deeper and the problem relies on - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer. On iOS8, it is called when the pan gesture (responsible for the scroll) is triggered, and on iOS9 it is not and jumps directly to the gesture's selector. Any tip? |
Finally found out the issue, and perhaps that's what's happening to @macsrok as well. What I was doing previously was creating a LXReorderableCollectionViewFlowLayout in viewDidLoad and then assigning it to the collectionView's collectionViewLayout. On iOS 9, this made the KVO trigger two times (one by the LXReorderableCollectionViewFlowLayout, and other by its superclass, collectionViewLayout). Therefore this led setupCollectionView to be ran twice, and thus the collectionView had two panGestureRecognizers. You can now understand why the crash occurred. In order to solve this, I added the LXReorderableCollectionViewFlowLayout in the xib and now everything is running fine! |
Also an issue for me - might want to incorporate a fix or add @nmcc24 's fix to the docs |
@nmcc24 thank you ! |
I've been using LXReorderableCollectionViewFlowLayout in an app for over a year now. It works great in ios 7 and 8 but is crashing in iOS 9. I can reorder items as long as I don't need to scroll. As soon as the collection view scrolls it crashes.
I have narrowed it down to
- (void)invalidateLayoutIfNecessary
previousIndexPath is nil and causing a crash. If anyone has seen this or can offer some advice as to how to fix it, it would be greatly appreciated.
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x27b2244b 0x39426dff 0x27a3b3cd 0x27a455e5 0x16078e7 0x2c3718e7 0x2c371801 0x2bddb9cd 0x1607795 0x160a235 0x2c114457 0x2bd92177 0x2bc294b3 0x2c113c47 0x2bbeb1cf 0x2bbe8d87 0x2bc27431 0x2bc26b7b 0x2bbf85c1 0x25e40fdb 0x2bbf6f47 0x27ae5407 0x27ae4ff7 0x27ae335f 0x27a35d89 0x27a35b7d 0x30bc8af9 0x2bc5e99d 0x280feb 0x39b74873)
libc++abi.dylib: terminating with uncaught exception of type NSException
The text was updated successfully, but these errors were encountered: