Comments (8)
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
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (16) must be equal to the number of items contained in that section before the update (16), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).'
*** First throw call stack:
(0x21e5f44b 0x336aadff 0x21e5f321 0x22bec3d3 0x266abd5b 0x266ae973 0x266ae801 0x261189cd 0x4fb569 0x4fe00d 0x26451457 0x260cf177 0x25f664b3 0x26450c47 0x25f281cf 0x25f25d87 0x25f64431 0x25f63b7b 0x25f355c1 0x25f33f47 0x21e22407 0x21e21ff7 0x21e2035f 0x21d72d89 0x21d72b7d 0x2af45af9 0x25f9b99d 0xe7f25 0x33df8873)
libc++abi.dylib: terminating with uncaught exception of type NSException
As macsrok said, the exception occurs in invalidateLayoutIfNecessary:, upon the performBatchUpdates:, because previousIndexPath is nil
from lxreorderablecollectionviewflowlayout.
@macsrok @nmcc24 Is this still the case? I'm trying the example project o iOS 9 Beta 5 and seems to be fine.
from lxreorderablecollectionviewflowlayout.
@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
from lxreorderablecollectionviewflowlayout.
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 ]];
from lxreorderablecollectionviewflowlayout.
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?
from lxreorderablecollectionviewflowlayout.
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!
from lxreorderablecollectionviewflowlayout.
Also an issue for me - might want to incorporate a fix or add @nmcc24 's fix to the docs
from lxreorderablecollectionviewflowlayout.
@nmcc24 thank you !
from lxreorderablecollectionviewflowlayout.
Related Issues (20)
- Conflict with IOS 9 introduced functions
- Crash when reorder cell between section HOT 2
- crash with move item from section1 to section2, HOT 1
- Used by Instagram
- Save cell order?
- paging feature?
- LongPress show whiteItem which you pressed in iPhone7 HOT 3
- Lock Cells while Dragging
- Maybe need optimization HOT 1
- Latest PR that was merged in does not compile HOT 1
- Could you update podspec to make sure pod update can get this new release? HOT 1
- Compilation error in version 0.2.0 HOT 3
- Add Drag and drop function HOT 1
- Uninstall existing gesture recognizers when calling `setupCollectionView` HOT 2
- UICollectionView scroll no longer works under iOS 9.0b HOT 3
- Stop Items to scroll back when one cell is picked Up
- closed HOT 1
- How to use in NSFetchResultController.
- Linking Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lxreorderablecollectionviewflowlayout.