我想从带有确认警报视图的tableview中删除一行。我已经在删除按钮操作上显示警告,但操作总是崩溃。
崩溃日志是:
[__ NSCFSet row]:无法识别的选择器发送到实例0x847c590
2012-08-11 12:20:35.583 EZDistributor [895:15803] * 终止应用 由于未捕获的异常'NSInvalidArgumentException',原因: ' - [__ NSCFSet row]:无法识别的选择器发送到实例0x847c590'
我的代码如下:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if(editingStyle == UITableViewCellEditingStyleDelete){
indexPath1= indexPath;
NSLog(@"%d %d", indexPath.row, indexPath1.row);
emailId = [[mailIDArray objectAtIndex:indexPath.row]objectForKey:@"header"];
leadCount = [[mailIDArray objectAtIndex:indexPath.row]objectForKey:@"countLeadinfo"];
NSString *stringMailtype = [[mailIDArray objectAtIndex:indexPath.row]objectForKey:@"forward"];
NSArray* foo = [stringMailtype componentsSeparatedByString: @"##"];
NSString* day1 = [foo objectAtIndex: 1];
mailTypeForward = day1;
mgridSave = [[NSString alloc]init];
mgridSave = emailId;
if([leadCount isEqualToString:@"0"]){
[self showAlert];
}
}
}
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if(alertSP){
NSLog(@"comes here");
if(buttonIndex == 1){
if([leadCount isEqualToString:@"0"]){
if(tableForword){
NSLog(@"indexpath %d" , indexPath1.row);
[mailIDArray removeObjectAtIndex:indexPath1.row];
[tableForword deleteRowsAtIndexPaths:[NSArray
arrayWithObject:indexPath1] withRowAnimation:UITableViewRowAnimationFade];
[tableForword setEditing:NO];
[tableForword reloadData];
[self deleteEmailId:payableStr2 forwardType:mailTypeForward
mgrID:mgridSave];
}
}
}
}
应用程序崩溃在这一行:
[mailIDArray removeObjectAtIndex:indexPath1.row];
请给我建议。我错过了什么?