Search code examples
iosobjective-cnsrangeexception

NSRangeException on textField/textView becomeFirstResponder


I have 2 textFields and 1 textView on a view. Only one of the textFields has the vc as a delegate. Whenever any of the 3 become firstResponder (either programmatically, or by being tapped), the app crashes. The error is:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:]: row (0) beyond bounds (0) for section (0).'

I have a tableView that i add programmatically as a subview, but I've removed all traces of the tableView from the h and m files and still get an error that references the tableView. This vc gets pushed from a tableViewController, could that be what is being referenced?

It crashes for the simulator on both iPhone and iPad using 6.1 and 5.1, also for iPhone using 6.1.3, but it works fine on an iPad running 6.1.3.

Any ideas?

Thanks


Solution

  • Did you first try cleaning your project? Also are you using any storyboard/nibs with the file?