Q:

textfield becomeFirstResponder gives EXC_BAD_ACCESS code

I have two textfields; on tap of one I open a pickerView and on tap of next textfield I want to remove above opened picker from view and open keyboard but using [textfield becomeFirst Responder] in textFieldShouldBeginEditing textfield delegate method I get EXC_BAD_ACCESS code crash.
The code is as such:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (textField == earningCodeTextField) {
    [self dismissKeyboard];
    [self showPickerView];
    return NO;
}
else if (textField == codeTextField) {
    [self hidePickerView];
    [codeTextField becomeFirstResponder];
    return YES;
}
return YES;
}

A:

Calling [codeTextField becomeFirstResponder]; in the textFieldShouldBeginEditing: will call the be textFieldShouldBeginEditing: again and this might cause the error. You should not call [codeTextField becomeFirstResponder]; because it is already becoming the first responder.

