iOS 4.3 模拟器上的 UITextField 自动更正崩溃
UITextField 的自动更正使我的应用程序在具有 iOS 4.3 sdk 构建目标的模拟器上崩溃。在带有 iOS 4.2 sdk 的设备和模拟器上运行良好。
还有其他人遇到这个问题吗?我认为这是 4.3 sdk 的一个错误?
当我输入第二个字符时。 堆栈跟踪
#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 ()
有时,您还会看到一个简单得多的跟踪,它只是从 main 开始,然后在 objc_assign_ivar 处立即停止。在文本字段(例如 UISearchBar)中输入内容时也会发生这种情况。
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.
Anyone else experiencing this issue? I'm figuring its a bug with the 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在模拟器上,打开设置->键盘并关闭所有选项。
这可以防止崩溃(直到错误得到解决)。
On the simulator, open Settings -> Keyboard and turn OFF all the options.
This prevents the crash (until the bug is addressed).
我在 Lion Developer Preview 2 上运行 4.3 模拟器时遇到了同样的问题。这是 Lion 上模拟器中的一个错误。我已暂时禁用自动更正(setAuto CorrectionType:UITextAuto CorrectionTypeNo)。
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).
我们必须按照以下步骤更新 Simulator 4.3:
并重置模拟器并再次运行。完成了。
We have to update Simulator 4.3 by following these steps:
And Reset Simulator and run it again. It's done.
如果您认为有错误,请在 http://bugreport.apple.com 提交错误报告SDK。
但是,回答你,我没有遇到同样的问题,所以这可能是你的代码中的问题。您能否在崩溃之前检查堆栈跟踪,看看是否缺少某些在旧操作系统版本中可以正常工作的内容?
参考:iOS开发指南
Please file a bug report at http://bugreport.apple.com if you feel that there is a bug in the SDK.
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
关闭模拟器键盘设置中的“自动更正”为我解决了这个问题。
Turning off "Auto-Correction" in the simulator keyboard settings fixed this issue for me.
我也遇到过这个问题。在我的情况下,我能够追踪到当前具有焦点的文本字段的 resignFirstResponder 调用。
我的代码看起来像这样:
现在,当我注释掉密码 resignFirstResponder 调用时,我不再遇到崩溃。
这绝对是一个错误,应该报告。
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.
I have code that looks something like this:
Now when i commented out the password resignFirstResponder call, I no longer got that crash.
This definitely is a bug and should be reported.