UITextField文本输入后,iOS应用程序崩溃,弹出,然后按我的navController(NSISObjectiveLinearExpression coefficientForVariable) [英] iOS app crash after UITextField text entry, pop, then push on my navController (NSISObjectiveLinearExpression coefficientForVariable)

查看:501
本文介绍了UITextField文本输入后,iOS应用程序崩溃,弹出,然后按我的navController(NSISObjectiveLinearExpression coefficientForVariable)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iOS应用程序在我崩溃时崩溃:

My iOS app crashes when I:


  • 在导航控制器中显示我的登录视图控制器

  • 在其上输入文本到 UITextField ,然后尝试登录失败

  • 弹回上面的视图控制器

  • 推送到另一个视图控制器(此处崩溃)

  • 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)

如果我跳过将文本输入 UITextField 的步骤,则会崩溃。

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:]:无法识别的
选择器发送到实例0x1cd93850

推荐答案

我也有这个问题。使用ARC,如果我将一个 UITextField 添加到一个空的xib中,我会得到这个崩溃,并且在编辑该字段后,弹出导航控制器堆栈的视图控制器。文本字段没有委托集,也没有连接到它的出口。然而它崩溃了!

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!

(如果你的情况和我一样,你没有实例化 NSISObjectiveLinearExpression mydogisbox暗示。)

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

经过多次搜索,我发现这个答案,建议在 viewWillDisappear 方法中调用 endEditing:。它似乎可以修复我的崩溃。

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];
}

这篇关于UITextField文本输入后,iOS应用程序崩溃,弹出,然后按我的navController(NSISObjectiveLinearExpression coefficientForVariable)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆