Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 滑动以删除单元格时出现断言失败错误_Ios_Objective C - Fatal编程技术网

Ios 滑动以删除单元格时出现断言失败错误

Ios 滑动以删除单元格时出现断言失败错误,ios,objective-c,Ios,Objective C,断点位于[self.tableView…]行 这是我第一次遇到这样的错误。我正在搞乱一个cocoapod,它实现了刷卡删除功能 - (void)swipeTableViewCell:(MCSwipeTableViewCell *)cell didTriggerState:(MCSwipeTableViewCellState)state withMode:(MCSwipeTableViewCellMode)mode { NSLog(@"IndexPath : %@ - MCSwipeTab

断点位于[self.tableView…]行

这是我第一次遇到这样的错误。我正在搞乱一个cocoapod,它实现了刷卡删除功能

- (void)swipeTableViewCell:(MCSwipeTableViewCell *)cell didTriggerState:(MCSwipeTableViewCellState)state withMode:(MCSwipeTableViewCellMode)mode
{
    NSLog(@"IndexPath : %@ - MCSwipeTableViewCellState : %d - MCSwipeTableViewCellMode : %d", [self.tableView indexPathForCell:cell], state, mode);

    if (mode == MCSwipeTableViewCellModeExit)
    {

        // Remove the item in your data array and then remove it with the following method
        [self.tableView deleteRowsAtIndexPaths:@[[self.tableView indexPathForCell:cell]] withRowAnimation:UITableViewRowAnimationFade];


    }
}
另外,假设有办法解决这个问题,是否可以从我的解析后端删除该对象?我最初使用的是:

PFObject *object = [self.objects objectAtIndex:indexPath.row];
        [object deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
            [self loadObjects];

感谢您的帮助。

通常,从tableView中删除项目时,需要首先修改基础数据。换句话说,如果从数组中绘制表,请首先从数组中删除该行,然后从表中删除该行

如果不起作用,您可以尝试:

[mytableView beginUpdates];

//do my changes

[mytableView endUpdates];

断言失败只能由显式调用一个
NSAssert
函数引起。这些用于测试开发人员所做的某些假设是否正确。他们“断言”这些假设的真实性,如果它们不真实,就会抛出一个例外


据我所知,任何苹果开发者库中都没有断言。这意味着要么你在代码中加入了断言,要么——更有可能——在你正在使用的cocoapod的代码中有一个断言。获取源代码并对“NSAssert”进行全局搜索,以了解发生了什么。

Hm.仍然抛出相同的断言,但现在转到[self.tableView endUpdates];