やあ
UITableView を介して NSMutableArray からアイテムを削除したいのですが、何かがアプリをクラッシュさせます。クラッシュは " 0 objc_msgSend
" です。
ここに私のコードがあります:
- (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];
}
ありがとう