I have a UITableView with 3 sections and each section is being fed through unique NSFetchedResultsController.
I am getting Assertion failure from the NSFetchedResultsController -controllerDidChangeContent, when inserting, updating...the table.
My guess is issue with indexPaths coming in method below as every controller has only single section (0) and for controller in section 0 the failure doesn't happen.
- (void)controller:(NSFetchedResultsController*)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath*)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath*)newIndexPath
{
switch(type)
{
case NSFetchedResultsChangeInsert:
[[self atableView] insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationLeft];
break;
case NSFetchedResultsChangeDelete:
[[self atableView] deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
break;
case NSFetchedResultsChangeUpdate:
[self configureCell:(DashboardViewCell *) [[self atableView] cellForRowAtIndexPath:indexPath] atIndexPath:indexPath];
break;
case NSFetchedResultsChangeMove:
[[self atableView] deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[[self atableView] insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
break;
}
}
So my question is, how can I determine which controller (from which section) is being processed and modify the indexPath accordingly and if that's the right way of doing it? And possibly any examples of using several nsfetchedresultscontrollers with one uitableview.