由于未捕获的异常终止应用程序' NSInvalidArgumentException',原因:' -deleteObject:核心数据中需要非零参数

时间:2014-06-25 05:37:33

标签: ios core-data

  - (void)tableView:(UITableView *)tableViewcommitEditingStyle:(UITableViewCellEditingStyle)editingStyleforRowAtIndexPath:(NSIndexPath *)indexPath
   {


if (editingStyle == UITableViewCellEditingStyleDelete)
    {

        if ([[self.fetchedResultsController fetchedObjects ]count]>0)

        {
            NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];
            [self.managedObjectContext deleteObject:managedObject];
            [self.managedObjectContext save:nil];
            //[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
        }
        [self.tableView reloadData];




    }
}

0 个答案:

没有答案