I haven't seen this error before, and I did a search as to why it may be happening but couldn't find any info on it:
CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. UITableView internal bug: unable to generate a new section map with old section count: 1 and new section count: 0 with userInfo (null)
Does anyone know what might be happening here? I am not sure about the "internal bug" part - does this error indicate a problem with my code or a bug in UITableView?
Stephan already mentioned this in a comment on the original question but I thought it was worth sharing some code. This answer was actually sourced from a comment made by user GERUB
on a thread on the apple dev forums found here: https://forums.developer.apple.com/thread/9964
if tableView.numberOfRowsInSection(indexPath.section) == 1{
tableView.deleteSections(NSIndexSet(index: indexPath.section), withRowAnimation: .Automatic)
}else{
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
I have tested this inside of the NSFetchedResultsControllerDelegate
method implementations and it works perfectly.
Did you use this NSFetchedResultsController in multiple UITableView. If so, that's the cause. Use one NSFetchedResultsController for one UITableView. Do not just switch queries when switching views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With