Giter Site home page Giter Site logo

Comments (8)

nmcc24 avatar nmcc24 commented on May 24, 2024

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.

TheCoordinator avatar TheCoordinator commented on May 24, 2024

@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.

nmcc24 avatar nmcc24 commented on May 24, 2024

@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.

nmcc24 avatar nmcc24 commented on May 24, 2024

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.

nmcc24 avatar nmcc24 commented on May 24, 2024

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.

nmcc24 avatar nmcc24 commented on May 24, 2024

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.

cvburgess avatar cvburgess commented on May 24, 2024

Also an issue for me - might want to incorporate a fix or add @nmcc24 's fix to the docs

from lxreorderablecollectionviewflowlayout.

pomarec avatar pomarec commented on May 24, 2024

@nmcc24 thank you !

from lxreorderablecollectionviewflowlayout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.