My code appears to run just fine but when I swipe to delete a line within my UITableView, the app crashes with the following:
LittleTo
I figured it out with the help from above and some thinking.
First, I finished the actual deleteToDoItem code
- (ToDoItem *) deleteToDoItem: (ToDoItem *) todoitem {
[ToDoItems removeObject:todoitem];
return todoitem;
}
Then the code above
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
ToDoItem *toDoItem = [[ToDoItemSvc retrieveAllToDoItems] objectAtIndex:indexPath.row];
[ToDoItemSvc deleteToDoItem:toDoItem];
[self.tableView reloadData];
NSLog(@"Removing data");
}
This runs and allows me to delete my item like I want!!