'Неверное обновление: неверное количество строк в разделе 0

Я прочитал все связанные сообщения об этом, и у меня все еще есть ошибка:

'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (5) must be equal to the number of rows contained in that section before the update (5), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'

Вот подробности:

в.h у меня естьNSMutableArray:

@property (strong,nonatomic) NSMutableArray *currentCart;

В.m мойnumberOfRowsInSection выглядит так:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.


    return ([currentCart count]);

}

Чтобы включить удаление и удаление объекта из массива:

// Editing of rows is enabled
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {

        //when delete is tapped
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];

        [currentCart removeObjectAtIndex:indexPath.row];


    }
}

Я думал, что, имея количество секций, основанное на количестве редактируемого массива, это обеспечит правильное количество строк? Разве это не может быть сделано без перезагрузки таблицы при удалении строки в любом случае?

Ответы на вопрос(2)

Ваш ответ на вопрос