環境:ios11 、 xcode 9
## - demo 代碼
- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath {
if(editingStyle ==UITableViewCellEditingStyleDelete) {
NSLog(@"indexPath.row = %ld",(long)indexPath.row);
//ios 11.1下的bug 刪除指定row會crash
//[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView reloadData];
}
}
據說是 ios11.1 的bug,見連接 https://forums.developer.apple.com/thread/88190 ios11.2已修復
比較無奈的解決辦法:
直接??[tableView reloadData];?