簡體   English   中英

使用原因setObjectForKey切換uitextfields時iOS 7.1更新崩潰:對象不能為nil(鍵:NSShadow)

[英]iOS 7.1 update crash when switching between uitextfields with reason setObjectForKey: object cannot be nil (key: NSShadow)

我們有一個失敗的復雜移動應用程序,它使用靜態表視圖進行輸入。 隨着ios 7.1的更新,我們現在在用戶瀏覽幾個文本字段而沒有輸入信息后發生崩潰,然后輸入內容並移動到下一個文本字段。 崩潰是

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' setObjectForKey: object cannot be nil (key: NSShadow)'

使用此堆棧跟蹤:

    * First throw call stack: (
0 CoreFoundation 0x000000010342b495 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010318a99e objc_exception_throw + 43
2 CoreFoundation 0x00000001034aa544 -[NSDictionaryM setObject:forKey:] + 916
3 UIKit 0x0000000101eb877c -[UILabel setShadow:] + 339
4 UIKit 0x0000000101eb88b5 -[UILabel setShadowColor:] + 100
5 CoreFoundation 0x0000000103420f1c invoking + 140
6 CoreFoundation 0x00000001034b0e84 -[NSInvocation invokeUsingIMP:] + 212
7 UIKit 0x00000001021f0b4d workaround10030904InvokeWithTarget_block_invoke + 88
8 UIKit 0x0000000101d7eecb +[UIView _performCustomizableAppearanceModifications:] + 33
9 UIKit 0x00000001021f0ae3 workaround10030904InvokeWithTarget + 938
10 UIKit 0x00000001021ebfc9 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 3482
11 UIKit 0x0000000101d938fa 88-[UIView(Internal) performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]block_invoke + 63
12 UIKit 0x0000000101d93885 -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 230
13 UIKit 0x0000000101d92e2c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1369
14 UIKit 0x0000000101d8b996 45-[UIView(Hierarchy) postMovedFromSuperview:]_block_invoke + 128
15 UIKit 0x0000000101d8b85c -[UIView(Hierarchy) _postMovedFromSuperview:] + 276
16 UIKit 0x0000000101d952ac -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1508
17 UIKit 0x000000010237d922 -[UITextField willDetachFieldEditor:] + 96
18 UIKit 0x0000000101e1b48e -[UIFieldEditor becomeFieldEditorForView:] + 236
19 UIKit 0x0000000102375497 -[UITextField _resignFirstResponder] + 197
20 UIKit 0x0000000101e6b212 -[UIResponder resignFirstResponder] + 128
21 UIKit 0x00000001023752db -[UITextField resignFirstResponder] + 114
22 UIKit 0x0000000101e6b011 -[UIResponder becomeFirstResponder] + 297
23 UIKit 0x0000000101d8b673 -[UIView(Hierarchy) becomeFirstResponder] + 99
24 UIKit 0x0000000102374b08 -[UITextField becomeFirstResponder] + 51
25 UIKit 0x0000000102067d01 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] + 187
26 UIKit 0x0000000102069b30 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:] + 1768
27 UIKit 0x000000010205ffc2 _UIGestureRecognizerSendActions + 188
28 UIKit 0x000000010205ef28 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 357
29 UIKit 0x00000001020632d9 UIGestureRecognizerUpdate_block_invoke + 53
30 UIKit 0x0000000102063261 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 257
31 UIKit 0x000000010205b337 _UIGestureRecognizerUpdate + 93
32 UIKit 0x0000000101d6fa15 -[UIWindow _sendGesturesForEvent:] + 928
33 UIKit 0x0000000101d706d4 -[UIWindow sendEvent:] + 909
34 UIKit 0x0000000101d4829a -[UIApplication sendEvent:] + 211
35 UIKit 0x0000000101d35aed _UIApplicationHandleEventQueue + 9579
36 CoreFoundation 0x00000001033bad21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
37 CoreFoundation 0x00000001033ba5f2 CFRunLoopDoSources0 + 242
38 CoreFoundation 0x00000001033d646f CFRunLoopRun + 767
39 CoreFoundation 0x00000001033d5d83 CFRunLoopRunSpecific + 467
40 GraphicsServices 0x000000010524cf04 GSEventRunModal + 161
41 UIKit 0x0000000101d37e33 UIApplicationMain + 1010
42 Sales Rabbit 0x000000010000c333 main + 115
43 libdyld.dylib 0x0000000103ac35fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

據我所知,當我們打電話時,崩潰正在發生

[curView becomeFirstResponder];

curView不是零,是一個uitextfield任何有關檢查或幫助的想法將不勝感激。

所以我最終找到答案,因為某些原因有人編寫了這行代碼,即使它似乎沒有必要。

[[UILabel appearance] setShadowColor:[UIColor clearColor]];

這導致它崩潰,但只是在我上面描述的情況下,而不是在應用程序委托中設置的情況。 似乎應該允許設置陰影顏色以清除,但為什么你這樣做對我來說並不明顯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM