4

My iOS app crashes when I:

  • present my "Login" view controller in a navigation controller
  • enter text into a UITextField on it, then try and fail the login
  • pop back to the above view controller
  • push to a different view controller (crashes here)

It doesn't crash if I skip the step where I enter text into the UITextField.

Does anyone have any idea why? Here is the error message I am getting.

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

changey
  • 18,606
  • 9
  • 28
  • 34

1 Answers1

4

I had this problem too. Using ARC, I would get this crash if I added a UITextField to an otherwise empty xib and, after editing the field, popped its view controller of the navigation controller's stack. The text field had no delegate set and no outlets connected to it. And yet it was crashing!

(If your situation was like mine, you weren't instantiating a NSISObjectiveLinearExpression as mydogisbox suggests. )

After much searching, I found this answer, which suggests calling endEditing: in your viewWillDisappear method. It appeared to fix my crash.

- (void) viewWillDisappear: (BOOL) animated {
    [super viewWillDisappear: animated];
    NSLog( @"In viewWillDisappear" );
    // Force any text fields that might be being edited to end so the text is stored
    [self.view.window endEditing: YES];
}
Community
  • 1
  • 1
zekel
  • 9,227
  • 10
  • 65
  • 96