• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ios - UITextField becomeFirstResponder 随机使 iOS 应用崩溃

[复制链接]
菜鸟教程小白 发表于 2022-12-13 11:48:00 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我开发了一个应用程序,它有多个文本字段,文本字段带有发光边框。当我进行内部测试时,它一直运行良好,但我看到 Fabric 使用以下堆栈跟踪报告崩溃。我是否遗漏了一些东西来追踪这个问题?有人能解释一下这个问题吗?

Thread : Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x185de0f48 __exceptionPreprocess
1  libobjc.A.dylib                0x19a92ff80 objc_exception_throw
2  CoreFoundation                 0x185de0e90 -[NSException initWithCoder:]
3  Foundation                     0x186c85fb4 -[NSISEngine minimizeConstantInObjectiveRowWithHead:]
4  Foundation                     0x186c85aa8 -[NSISEngine optimize]
5  Foundation                     0x186c815dc -[NSISEngine withBehaviors:performModifications:]
6  UIKit                          0x18b36e1d4 -[UIView(Hierarchy) _postMovedFromSuperview:]
7  UIKit                          0x18b680834 __UIViewWasRemovedFromSuperview
8  UIKit                          0x18b36cbf8 -[UIView(Hierarchy) removeFromSuperview]
9  UIKit                          0x18b895e58 -[UIKeyboardPredictionView setPredictionViewState:animate:notify:]
10 UIKit                          0x18b77f41c -[UIKeyboardImpl updatePredictionView]
11 UIKit                          0x18b486c68 -[UIKeyboardImpl finishLayoutChangeWithArguments:]
12 UIKit                          0x18b39ce8c -[UIKeyboardImpl updateLayout]
13 UIKit                          0x18b3a1bd4 -[UIKeyboardImpl setDelegate:force:]
14 UIKit                          0x18b39b0b8 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
15 UIKit                          0x18b39abec -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
16 UIKit                          0x18b3fc09c -[UIResponder becomeFirstResponder]
17 UIKit                          0x18b3fc448 -[UIView(Hierarchy) becomeFirstResponder]
18 UIKit                          0x18b483814 -[UITextField becomeFirstResponder]
19 MyApp                          0x10012f6a4 -[FormattedField becomeFirstResponder] (GlowingTextField.m:139)
20 MyApp                          0x100130190 -[GlowingTextField becomeFirstResponder] (GlowingTextField.m:271)
21 UIKit                          0x18b5341a8 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary]
22 UIKit                          0x18b53365c -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:]
23 UIKit                          0x18b8ef330 _UIGestureRecognizerSendTargetActions
24 UIKit                          0x18b518b5c _UIGestureRecognizerSendActions
25 UIKit                          0x18b3a685c -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
26 UIKit                          0x18b8f070c ___UIGestureRecognizerUpdate_block_invoke898
27 UIKit                          0x18b3658b8 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks
28 UIKit                          0x18b36263c _UIGestureRecognizerUpdate
29 UIKit                          0x18b3a46cc -[UIWindow _sendGesturesForEvent:]
30 UIKit                          0x18b3a3cc8 -[UIWindow sendEvent:]
31 UIKit                          0x18b3744a4 -[UIApplication sendEvent:]
32 UIKit                          0x18b37276c _UIApplicationHandleEventQueue
33 CoreFoundation                 0x185d98544 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
34 CoreFoundation                 0x185d97fd8 __CFRunLoopDoSources0
35 CoreFoundation                 0x185d95cd8 __CFRunLoopRun
36 CoreFoundation                 0x185cc4ca0 CFRunLoopRunSpecific
37 GraphicsServices               0x190d2c088 GSEventRunModal
38 UIKit                          0x18b3dcffc UIApplicationMain
39 MyApp                          0x1000599ec main (main.m:14)
40 libdyld.dylib                  0x19b1728b8 start



Best Answer-推荐答案


我之前也遇到过同样的崩溃。原因是 View Controller 已释放并且 UITextField.delegate 未设置为零,是悬空指针问题。我在 View Controller 的 dealloc 方法中设置 UITextField.delegate = nil,bug 已修复。

关于ios - UITextField becomeFirstResponder 随机使 iOS 应用崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33800918/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap