Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Predicate update for DATASource cause crash #104

Closed
tibibo opened this issue May 12, 2017 · 2 comments
Closed

Predicate update for DATASource cause crash #104

tibibo opened this issue May 12, 2017 · 2 comments

Comments

@tibibo
Copy link
Contributor

tibibo commented May 12, 2017

In case the new predicate change amount of items, collection view crashed:

2017-05-12 11:23:26.192 SwiftDemo[12755:330575] *** 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 (14) 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 (10 inserted, 10 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).'

To repeat this issue just add to Swift Demo project inside one of CollectionViewController:

func saveAction() {
        Helper.addNewUser(dataStack: self.dataStack)
        self.dataSource.predicate = NSPredicate(format: "role == %@", "manager")
 }

Possible solution (rollback "Safer UICollection reloading") in Merge Request — #103

@3lvis
Copy link
Owner

3lvis commented May 13, 2017

Thanks for suggesting this fix, @tibibo I'll check it out.

Have a nice weekend :)

@3lvis 3lvis closed this as completed Jul 7, 2017
@3lvis
Copy link
Owner

3lvis commented Jul 7, 2017

Merged #103

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants