This repository was archived by the owner on Nov 17, 2025. It is now read-only.
Fix batch updates with NSFetchedResultsController assertions#295
Merged
steipete merged 4 commits intosteipete:masterfrom Apr 17, 2013
Merged
Fix batch updates with NSFetchedResultsController assertions#295steipete merged 4 commits intosteipete:masterfrom
steipete merged 4 commits intosteipete:masterfrom
Conversation
Since deletes happen before moves, indexPathBeforeUpdate.item may no longer point to correct index, so search for the object we're looking for and use its index.
Contributor
Author
|
I added a test app based off the CircleLayout app. It runs random batches of inserts, moves, reloads, and deletes. Its not very well written and since its random, it can be hard to reproduce specific issues, so maybe its not all that useful ;-). But it does show the bugs, especially when you run it using Apple's code, which doesn't crash, but still shows some weird behavior. |
Owner
|
Looks all good to me - thanks! |
steipete
added a commit
that referenced
this pull request
Apr 17, 2013
Fix batch updates with NSFetchedResultsController assertions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've been attempting to use NSFetchedResultsController to update a PSTCollectionView, and its causing a bunch of assertions and errors. I've tackled some here, but there's at least one more to fix.
Here's a run down of what I've done so far:
indexOfObjectinstead ofobjectAtIndexsince we know what the object is. Not 100% sure about this, but it works in my case.The next issue (hopefully the last) has to do with mixing reloads and deletes. A reload is implemented as a delete and insert. If that is mixed with other deletes, then again the indexes become invalid. I think it might be easier to just keep these as a reload operation, but I'm not sure what constitutes a reload.
Is calling
[PSTCollectionView createPreparedCellForItemAtIndexPath:withLayoutAttributes:]sufficient?