Hi
I want to delete items from a NSMutableArray through a UITableView but something crash the app.
The crash is "0 objc_msgSend
".
Here's my code guys:
- (void)viewDidLoad
{
paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
path = [basePath stringByAppendingPathComponent:@"favoris.plist"];
dict = [[NSArray arrayWithContentsOfFile:path] mutableCopy];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
[dict removeObjectAtIndex:indexPath.row];
[self.tableView reloadData];
}
Thanks