iOS app crash after UITextField text entry, pop, then push on my navController (NSISObjectiveLinearExpression coefficientForVariable)

后端 未结 1 2008
故里飘歌
故里飘歌 2021-01-01 05:09

My iOS app crashes when I:

  • present my \"Login\" view controller in a navigation controller
  • enter text into a UITextField on it, then try
相关标签:
1条回答
  • 2021-01-01 05:24

    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];
    }
    
    0 讨论(0)
提交回复
热议问题