ios - UITextField becomeFirstResponder 随机使 iOS 应用崩溃
<p><p>我开发了一个应用程序,它有多个文本字段,文本字段带有发光边框。当我进行内部测试时,它一直运行良好,但我看到 Fabric 使用以下堆栈跟踪报告崩溃。我是否遗漏了一些东西来追踪这个问题?有人能解释一下这个问题吗?</p>
<pre><code>Thread : Fatal Exception: NSInternalInconsistencyException
0CoreFoundation 0x185de0f48 __exceptionPreprocess
1libobjc.A.dylib 0x19a92ff80 objc_exception_throw
2CoreFoundation 0x185de0e90 -
3Foundation 0x186c85fb4 -
4Foundation 0x186c85aa8 -
5Foundation 0x186c815dc -
6UIKit 0x18b36e1d4 -
7UIKit 0x18b680834 __UIViewWasRemovedFromSuperview
8UIKit 0x18b36cbf8 -
9UIKit 0x18b895e58 -
10 UIKit 0x18b77f41c -
11 UIKit 0x18b486c68 -
12 UIKit 0x18b39ce8c -
13 UIKit 0x18b3a1bd4 -
14 UIKit 0x18b39b0b8 -
15 UIKit 0x18b39abec -
16 UIKit 0x18b3fc09c -
17 UIKit 0x18b3fc448 -
18 UIKit 0x18b483814 -
19 MyApp 0x10012f6a4 - (GlowingTextField.m:139)
20 MyApp 0x100130190 - (GlowingTextField.m:271)
21 UIKit 0x18b5341a8 -
22 UIKit 0x18b53365c -
23 UIKit 0x18b8ef330 _UIGestureRecognizerSendTargetActions
24 UIKit 0x18b518b5c _UIGestureRecognizerSendActions
25 UIKit 0x18b3a685c -
26 UIKit 0x18b8f070c ___UIGestureRecognizerUpdate_block_invoke898
27 UIKit 0x18b3658b8 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks
28 UIKit 0x18b36263c _UIGestureRecognizerUpdate
29 UIKit 0x18b3a46cc -
30 UIKit 0x18b3a3cc8 -
31 UIKit 0x18b3744a4 -
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
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我之前也遇到过同样的崩溃。原因是 ViewController 已释放并且 UITextField.delegate 未设置为零,是悬空指针问题。我在 ViewController 的 dealloc 方法中设置 UITextField.delegate = nil,bug 已修复。</p></p>
<p style="font-size: 20px;">关于ios - UITextField becomeFirstResponder 随机使 iOS 应用崩溃,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/33800918/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/33800918/
</a>
</p>
页:
[1]