views:

44

answers:

0

I have table view which is in a view controller that inherits from UITableViewController.

I use a NSFetchedResultsController that I use to fetch the table data from my core data store. I've tried it with both caching on and off.

I set the delegate of the NSFetchedResultsController to be self and I've implemented controllerDidChangeContent in my view controller.

I've always implemented the table view delegate functions including commitEditingStyle which is called when the user deletes a row.

Here is what happens. The user swipes and deletes a row and commitEditingStyle is called as expected. In that function, I modify my core data objects to so that they are effectively deleted from results. In other words, if you ran the query I passed NSFetchedResultsController again, that row would now no longer be in the results set.

This alone is not enough, so I added a called to tableView reloadData at the end of commitEditingStyle. Still no luck, so I added a refresh button that calls reloadData and that doesn't help either. Going to another view controller (by hitting "back") and returning to the page doesn't usually work, but eventually it figures it out and the row will disappear correctly. Rerunning the program from scratch always works, of course, but how can I get my tableView to update correctly? controllerDidChangeContent never gets called by the way. I thought reloadData would be enough, but it doesn't seem to be.