In Visual Basic, there's a line of code you can use to handle errors in code
"On Error Resume Next"
Is there something similar in Objective-C? My problem is I have an "Add New Cell" add button that creates a new cell during runtime. However, the cells are re-orderable. When you try to re-order the "Add New Cell" cell, I get an index out of bounds error. If I can just fix the error from occurring that would be great, but if there's an error handler I can use to just exit the move function when there is an error, that would be cool too.
Here is my moveRowAtIndexPath code:
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
iProfileAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
[appDelegate moveFromOriginal:fromIndexPath.row toNew:toIndexPath.row];
}
Here is the error i receive:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (7) beyond bounds (7)'