テーブルビューのデータ ソースは配列から取得され、管理対象オブジェクト コンテキストの executeFetchRequest メソッドからデータを取得します。commitEditingStyle デリゲートで、次のエラーが発生しました。
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (1),
デリゲート:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[self.managedOjbectContext deleteObject:[self.myEvents objectAtIndex:indexPath.row]];
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView reloadData];
}
}