I have several issues with nagging with NSFetchedResultsController and CoreData, any of which I would really appreciate help.
Problem 1 - Updates: I update my store in the background thread, which leads to the removal, insertion or updating of certain rows. Changes are merged into the main thread context using the mergeChangesFromContextDidSaveNotification: method. The inserts and deletes are updated properly, but the updates are not (for example, the cell shortcut is not updated with the change), although I confirmed that the updates go through contextDidSaveNotifcation, just like the inserts and deleted. My current workaround is to temporarily change the stagnation interval in the context to 0, but that doesn't seem like the perfect solution.
Problem 2 - Deleting objects: my sample size is 20. If the object is deleted by the background thread, which is in the first 20 lines, everything works fine. But if the object is after the first 20 lines, and the table scrolls down, the error "CoreData cannot execute the error" occurs. I tried to reset the context and execute fc fetch - all to no avail. Note. In this scenario, the delegation method frc "didChangeObject ...." is not called for deletion - I assume that this is because this object was not damaged at this time (because it was out of the initial selection range). But for some reason, the context still considers the object to be around, although it has been removed from the repository.
Problem 3 - Deleting partitions: when deleting a row results in deleting a partition, I got "invalid number of rows in a partition ???" error. I worked on this by removing the string "reloadSection" from the NSFetchedResultsChangeMove: section and replacing it with "[tableView insertRowsAtIndexPaths ....". This seems to work, but once again I'm not sure if this is the best solution.
Any help would be greatly appreciated. Thank!
source
share