Iphone 移动包含核心数据的UITableView节的最后一行时->;nsrange异常

Iphone 移动包含核心数据的UITableView节的最后一行时->;nsrange异常,iphone,cocoa-touch,uitableview,core-data,Iphone,Cocoa Touch,Uitableview,Core Data,您好:在apple文档中提到的“controllerDidChangeContent:”中实现了“userDrivenChange”签入后,在Core Data backed UITableView中的节之间移动行效果非常好。 但只有当将节的最后一行移动到另一节时,我才会得到一个NSRangeException。当节变空时,显然存在一个问题。如何以最佳方式处理此问题?您是否实现了-controller:didchangessection:atIndex:forChangeType:方法?如果不是

您好:在apple文档中提到的“controllerDidChangeContent:”中实现了“userDrivenChange”签入后,在Core Data backed UITableView中的节之间移动行效果非常好。
但只有当将节的最后一行移动到另一节时,我才会得到一个NSRangeException。当节变空时,显然存在一个问题。如何以最佳方式处理此问题?

您是否实现了
-controller:didchangessection:atIndex:forChangeType:
方法?如果不是,则可能是这样:

-(void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type {     
    switch(type) {          
        case NSFetchedResultsChangeInsert:
            [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
            break;

        case NSFetchedResultsChangeDelete:
            [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
            break;
    }
}
-(void)控制器:(NSFetchedResultsController*)控制器didChangeSection:(id)sectionInfo atIndex:(nsInteger)ChangeType的sectionIndex:(NSFetchedResultsChangeType)类型{
开关(类型){
案例NSFetchedResultsChangesInsert:
[self.tableView insertSections:[NSIndexSet IndexSetWithiIndex:sectionIndex]带RowAnimation:UITableViewRowAnimationFade];
打破
案例NSFetchedResultsChangeDelete:
[self.tableView deleteSections:[NSIndexSet IndexSetWithiIndex:sectionIndex]带RowAnimation:UITableViewRowAnimationFade];
打破
}
}

你能提供一些代码来解释你现在在做什么吗?