0

Whenever my popover is dismissed by touching in another view when keyboard is shown for a UITextField, my app crashes with this error -

[NSISObjectiveLinearExpression coefficientForVariable:]: unrecognized selector sent to instance 0x1cd93850

I've found this post, explaining that I should endEditing in viewWillDisappear, but it didn't help, while debugging it crashes before even getting to viewWillDisappear.

Community
  • 1
  • 1
Kof
  • 23,893
  • 9
  • 56
  • 81

1 Answers1

0

I've found that popoverControllerShouldDismissPopover is called at the UIPopoverViewControllerDelegate before the crash, so I've planted endEditing over there and it worked.

This is the delegate's code -

- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController
{
    [self.view.window endEditing: YES];

    return YES;
}
Kof
  • 23,893
  • 9
  • 56
  • 81