相关疑难解决方法(0)

在deleteRowsAtIndexPaths上崩溃

当我从表中删除行时,我的应用程序崩溃了.以下是检测到错误和堆栈跟踪的源代码.感谢名单!

//delete row from database
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"\ncommitEditingStyle");

    //delete user from Users table with specified ID
    if(editingStyle == UITableViewCellEditingStyleDelete) 
    {

        //Get the object to delete from the array.
        [dbManager open: @DB_FILE_NAME];    

        //get userID from array usersIDList[row] = userID!
        NSNumber *usersID = [usersIDList objectAtIndex: [indexPath row]];
        [dbManager deleteUserWithID: [usersID intValue] table: @TABLE_USERS fieldName: @"UserID" ];

        [dbManager close];

        //Delete the object from the table.
        [self.tableView deleteRowsAtIndexPaths:
         [NSArray arrayWithObject: indexPath] 
        withRowAnimation: UITableViewRowAnimationFade];
    }
}

- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview delete-row

12
推荐指数
4
解决办法
3万
查看次数

标签 统计

delete-row ×1

iphone ×1

uitableview ×1