2015-11-19 114 views
2

我開發了一個應用程序,該應用程序具有多個帶文本字段輝光邊框的文本字段。當我進行內部測試時,它一直工作正常,但我看到Fabric使用以下堆棧跟蹤報告崩潰。我錯過了什麼來追蹤這個問題?任何人都可以在這個問題上提出一些看法嗎?UITextField becomeFirstResponder隨機崩潰iOS應用程序

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 
+0

您可以在視圖控制器中使用TapGesture事件來退出鍵盤嗎? –

+0

是的,我正在使用TapGesture已經退出鍵盤 –

+0

我多次面臨同樣的錯誤。 –

回答

1

我得到了相同的崩潰before.And的原因是視圖控制器已經發布和UITextField.delegate沒有設置爲零,是一個懸擺指針的問題。我在視圖控制器的dealloc方法中設置了UITextField.delegate = nil,修正了bug。

+0

感謝您的更新。我在dealloc中保持零。但我無法確認它是否得到修正。因爲這次崩潰並沒有通過我的內部測試來確認此修復是否能夠實現無崩潰。你能給出一些光線來製作它並確認修復嗎? –

+0

@SrinivasG您是否可以確認將代表設置爲零可解決問題?如果沒有,你有沒有想出正確的解決方案? – Carl

+0

@SrinivasG你能否確認它是否解決了你的問題? –