i am trying to delete a cell from my table view but it's displaying exception:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[RootViewController aBook]: unrecognized selector sent to instance 0x3d217a0'
here is my code:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
NSLog(@"handover values to object");
Book *aBook = [appDelegate.books objectAtIndex:indexPath.row];
NSLog(@"removing");
[[self aBook] removeObjectAtIndex:[indexPath row]];
NSLog(@"deleting row");
// Animate deletion
NSArray *indexPaths = [NSArray arrayWithObject:indexPath];
[[self tableView] deleteRowsAtIndexPaths:indexPaths
withRowAnimation:UITableViewRowAnimationFade];
}
control displays exception at 8th line after printing "removing" word. also giving warning that "root view controller not responding to aBook" help!!