I have a UITableViewController with an NSMutableArray in the header, like this:
NSMutableArray *someArray;
I also have a declared property:
@property (nonatomic, retain) NSMutableArray *someArray;
In the .m file, I load the array into a method:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
someArray = [[NSMutableArray alloc] init];
[self loadArrayData];
[tableview reloadData];
}
The table fills perfectly, adding is not a problem, but when I try to delete a row, the application crashes in the following row:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[someArray removeObjectAtIndex:indexPath.row];
If I use a debugger, I see that the array has some objects, and when I register indexPath.row, I get a value that is inside the size of the array.
I don’t understand why it collapses on this line ... Who can help me?
Console Outputs:
* - "NSInvalidArgumentException", : '- [__ NSArrayI removeObjectAtIndex:]: , 0x6193890'