NSInteralInconsistencyException - UIKeyboardLayoutAlignmentView

前端 未结 4 2127
旧时难觅i
旧时难觅i 2020-12-06 04:42

I am getting the follow crash in my reports but I don\'t have a clue as to where to start looking! - any help appreciated. I have no calls or reference to UIKeyboardLayoutA

4条回答
  •  时光取名叫无心
    2020-12-06 04:52

    Ok, problem found an fixed. On iOS8.3 if you the keyboard is being displayed and then you try to display a UIAlertView or UIAlertController that has an input field you will get this crash.

    Simple solution (for me) was to insert

    [self.window endEditing:YES]; 
    

    or

    [self.view endEditing:YES];
    

    in front of any alerts that do this and it no longer crashes

    Update

    In some cases I have also needed the following line (as outlined by Oren below), with the endEditing AND this line I have zero issues - but with one OR the other I have seen the odd crash which is weird - but the combo attack seems to work !

    UITextField *txtEmail = [alertView textFieldAtIndex:0];
    [txtEmail becomeFirstResponder];
    

提交回复
热议问题