我的代码似乎运行得很好但是当我滑动删除我的UITableView中的一行时,应用程序崩溃了以下内容:
LittleToDoApp [70390:4116002]***由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'无效更新:第0节中的行数无效.更新后的现有部分中包含的行数(1)必须为等于更新前的该部分中包含的行数(1),加上或减去从该部分插入或删除的行数(插入0,删除1),加上或减去移入或移出的行数该部分(0移入,0移出).
#import "ViewController.h"
#import "ToDoItem.h"
#import "ToDoItemSvcCache.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize tableView;
ToDoItemSvcCache *ToDoItemSvc = nil;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
ToDoItemSvc = [[ToDoItemSvcCache alloc] init];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)deleteToDoItem:(id)sender {
NSLog(@"Deleting ToDoItem");
[self.view endEditing:YES];
}
- (IBAction)addToDoItem:(id)sender {
[self.view endEditing:YES];
NSLog(@"saveToDoItem: entering");
ToDoItem *todoitem = …Run Code Online (Sandbox Code Playgroud)