I have a static NSMutableArray, and this array is the data source of my table view. Then I delete a cell from my table view and it crashes.
here is where I create the array:
static NSMutableArray *listaPiscinas;
my code:
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[listaPiscinas removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
[TratamentoView setListaPiscinas:listaPiscinas];
NSString *URLdeletarPiscina = [[NSString alloc] initWithFormat:@"%@app/excluir_piscina.php?cod_cliente_piscina=%@", URL_CADASTRO, [[listaPiscinas objectAtIndex:indexPath.row] objectForKey:@"cod_cliente_piscina"]];
dataReciever = [[AsyncDownloader alloc] initWithGetAdress:URLdeletarPiscina delegate:self];
[tableView reloadData];
}
}