在模拟器上的iOS 4.3中UITextField自动更正崩溃

时间:2023-01-12 23:54:02

The UITextField's auto correction crashes my app on the simulator with iOS 4.3 sdk build target. Works fine on the device and in the simulator with iOS 4.2 sdk.

UITextField的自动更正会在iOS 4.3 sdk构建目标的模拟器上崩溃我的应用程序。使用iOS 4.2 sdk在设备和模拟器中正常工作。

Anyone else experiencing this issue? I'm figuring its a bug with the 4.3 sdk?

其他人遇到此问题?我正在考虑4.3 sdk的错误?

As soon as I type the second character. Stack Trace

一旦我输入第二个字符。堆栈跟踪

#0  0x01c01000 in objc_assign_ivar ()
#1  0x03b7ec34 in -[AppleSpell init] ()
#2  0x007e7538 in -[UITextChecker _checker] ()
#3  0x007e8de9 in -[UITextChecker checkSpellingOfString:startingAt:language:wrap:correction:] ()
#4  0x0b335725 in TIInputManagerZephyr::lookup_spellcheck_candidates(KB::String const&) ()
#5  0x0b3353f3 in TIInputManagerZephyr::lookup_static_dynamic_candidates(KB::String const&, KB::String const&, KB::Vector<KB::FPoint> const&, bool) ()
#6  0x0b332b2b in TIInputManager::lookup() ()
#7  0x0b332e18 in TIInputManager::autocorrection() ()
#8  0x0b34a06b in -[TIKeyboardInputManagerZephyr autocorrection] ()
#9  0x005cfbe8 in -[UIKeyboardImpl generateCandidatesWithCompletions:] ()
#10 0x005cfc3b in -[UIKeyboardImpl generateCandidates] ()
#11 0x005dca23 in -[UIKeyboardImpl addInputString:fromVariantKey:] ()
#12 0x005de71b in -[UIKeyboardImpl handleKeyEvent:] ()
#13 0x0070a2ee in -[UIKeyboardLayoutStar sendStringAction:forKey:] ()
#14 0x0070ed19 in -[UIKeyboardLayoutStar touchUp:] ()
#15 0x005ebda2 in -[UIKeyboardLayout touchesEnded:withEvent:] ()
#16 0x004b8ded in -[UIWindow _sendTouchesForEvent:] ()
#17 0x00499c37 in -[UIApplication sendEvent:] ()
#18 0x0049ef2e in _UIApplicationHandleEvent ()
#19 0x02011992 in PurpleEventCallback ()
#20 0x0176a944 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#21 0x016cacf7 in __CFRunLoopDoSource1 ()
#22 0x016c7f83 in __CFRunLoopRun ()
#23 0x016c7840 in CFRunLoopRunSpecific ()
#24 0x016c7761 in CFRunLoopRunInMode ()
#25 0x020101c4 in GSEventRunModal ()
#26 0x02010289 in GSEventRun ()
#27 0x004a2c93 in UIApplicationMain ()

Also at times, you will see a much simpler trace that simply starts at main, then ceases immediately on objc_assign_ivar. This happens also when typing in a text field, such as a UISearchBar.

有时,您会看到一个简单的跟踪,它只是从main开始,然后立即停止在objc_assign_ivar上。键入文本字段(例如UISearchBar)时也会发生这种情况。

6 个解决方案

#1


34  

On the simulator, open Settings -> Keyboard and turn OFF all the options. This prevents the crash (until the bug is addressed).

在模拟器上,打开“设置” - >“键盘”并关闭所有选项。这可以防止崩溃(直到bug被解决)。

#2


7  

I am experiencing the same issue, running the 4.3 simulator on Lion Developer Preview 2. This is a bug in the simulator on Lion. I have been temporarily disabling autocorrection (setAutocorrectionType: UITextAutocorrectionTypeNo).

我遇到了同样的问题,在Lion Developer Preview 2上运行4.3模拟器。这是Lion上模拟器中的一个错误。我暂时禁用了自动更正(setAutocorrectionType:UITextAutocorrectionTypeNo)。

#3


6  

We have to update Simulator 4.3 by following these steps:

我们必须按照以下步骤更新Simulator 4.3:

  1. Go to Xcode -> Preferences -> Download
  2. 转到Xcode - >首选项 - >下载
  3. Update iOS 4.3 Simulator
  4. 更新iOS 4.3模拟器

And Reset Simulator and run it again. It's done.

并重置模拟器并再次运行它。完成。

#4


3  

Please file a bug report at http://bugreport.apple.com if you feel that there is a bug in the SDK.

如果您认为SDK中存在错误,请在http://bugreport.apple.com上提交错误报告。

But, to answer you, I am not experiencing the same issue, so it might be a problem in your code. Could you check the stack trace before the crash and see if there's something you're missing that somehow worked in older OS versions?

但是,为了回答你,我没有遇到同样的问题,所以它可能是你的代码中的一个问题。你可以在崩溃之前检查堆栈跟踪,看看是否有某些东西你在旧的操作系统版本中以某种方式工作了吗?

Reference: iOS Development guide

参考:iOS开发指南

#5


1  

Turning off "Auto-Correction" in the simulator keyboard settings fixed this issue for me.

关闭模拟器键盘设置中的“自动更正”为我解决了这个问题。

在模拟器上的iOS 4.3中UITextField自动更正崩溃

#6


0  

I have been encountering this issue as well. In my situation I was able to track it down to the resignFirstResponder call of a text field that currently has focus.

我也遇到过这个问题。在我的情况下,我能够将其跟踪到当前具有焦点的文本字段的resignFirstResponder调用。

I have code that looks something like this:

我的代码看起来像这样:

if(loginSuccess) {
    [self.userName resignFirstResponder]; 
    [self.password resignFirstResponder]; // This is the one with focus
}

Now when i commented out the password resignFirstResponder call, I no longer got that crash.

现在,当我注释掉密码resignFirstResponder调用时,我不再遇到崩溃。

This definitely is a bug and should be reported.

这肯定是一个错误,应该报告。

#1


34  

On the simulator, open Settings -> Keyboard and turn OFF all the options. This prevents the crash (until the bug is addressed).

在模拟器上,打开“设置” - >“键盘”并关闭所有选项。这可以防止崩溃(直到bug被解决)。

#2


7  

I am experiencing the same issue, running the 4.3 simulator on Lion Developer Preview 2. This is a bug in the simulator on Lion. I have been temporarily disabling autocorrection (setAutocorrectionType: UITextAutocorrectionTypeNo).

我遇到了同样的问题,在Lion Developer Preview 2上运行4.3模拟器。这是Lion上模拟器中的一个错误。我暂时禁用了自动更正(setAutocorrectionType:UITextAutocorrectionTypeNo)。

#3


6  

We have to update Simulator 4.3 by following these steps:

我们必须按照以下步骤更新Simulator 4.3:

  1. Go to Xcode -> Preferences -> Download
  2. 转到Xcode - >首选项 - >下载
  3. Update iOS 4.3 Simulator
  4. 更新iOS 4.3模拟器

And Reset Simulator and run it again. It's done.

并重置模拟器并再次运行它。完成。

#4


3  

Please file a bug report at http://bugreport.apple.com if you feel that there is a bug in the SDK.

如果您认为SDK中存在错误,请在http://bugreport.apple.com上提交错误报告。

But, to answer you, I am not experiencing the same issue, so it might be a problem in your code. Could you check the stack trace before the crash and see if there's something you're missing that somehow worked in older OS versions?

但是,为了回答你,我没有遇到同样的问题,所以它可能是你的代码中的一个问题。你可以在崩溃之前检查堆栈跟踪,看看是否有某些东西你在旧的操作系统版本中以某种方式工作了吗?

Reference: iOS Development guide

参考:iOS开发指南

#5


1  

Turning off "Auto-Correction" in the simulator keyboard settings fixed this issue for me.

关闭模拟器键盘设置中的“自动更正”为我解决了这个问题。

在模拟器上的iOS 4.3中UITextField自动更正崩溃

#6


0  

I have been encountering this issue as well. In my situation I was able to track it down to the resignFirstResponder call of a text field that currently has focus.

我也遇到过这个问题。在我的情况下,我能够将其跟踪到当前具有焦点的文本字段的resignFirstResponder调用。

I have code that looks something like this:

我的代码看起来像这样:

if(loginSuccess) {
    [self.userName resignFirstResponder]; 
    [self.password resignFirstResponder]; // This is the one with focus
}

Now when i commented out the password resignFirstResponder call, I no longer got that crash.

现在,当我注释掉密码resignFirstResponder调用时,我不再遇到崩溃。

This definitely is a bug and should be reported.

这肯定是一个错误,应该报告。