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

NSInternalInconsistencyException #3

Open
eisfair opened this issue Sep 2, 2015 · 0 comments
Open

NSInternalInconsistencyException #3

eisfair opened this issue Sep 2, 2015 · 0 comments

Comments

@eisfair
Copy link

eisfair commented Sep 2, 2015

Hello,
i really can't find the reason why this error is raised since everything is in line with your examples. I have never worked with CollectionView before, so maybe i'm missing something fundamental? Maybe it's because i try to implement this into a widget?

@IBOutlet weak var viewCollection: UICollectionView!

lazy var sapporo: Sapporo = { [unowned self] in
    return Sapporo(collectionView: self.viewCollection)
    }()

Then in viewDidLoad:

var models : [CollectionCellModel] = [];

    for participation in participations {

        let model = CollectionCellModel(title: participation.module.name, des: "", selectionHandler: {(cell) -> Void in
            println(cell.cellmodel)
        })

        models.append(model);
    }

    sapporo[0].insert(models, atIndex: 1).bump()

leads to:

    Widget[71046:859777] *** 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 (2) must be equal to the number of items contained in that section before the update (2), plus or minus the number of items inserted or deleted from that section (2 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:
(
    0   CoreFoundation                      0x000000010a85bc65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010c409bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010a85baca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x000000010acf898f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
    4   UIKit                               0x000000010b72a78e -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:] + 12818
    5   Sapporo                             0x000000010c6438b3 _TFC7Sapporo7Sapporo6bumpMefS0_FOS_15SectionBumpTypeT_ + 899
    6   Sapporo                             0x000000010c64403e _TTWC7Sapporo7SapporoS_17SASectionDelegateS_FS1_6bumpMeUS1___fQPS1_FOS_15SectionBumpTypeT_ + 14
    7   Sapporo                             0x000000010c637427 _TFC7Sapporo9SASection4bumpfS0_FT_T_ + 759
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant