1

我们有一个失败的复杂移动应用程序,它使用静态表格视图进行输入。随着对 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 任何关于检查或帮助的想法将不胜感激。

4

1 回答 1

3

所以我最终找到了答案,出于某种原因,有人编写了这行代码,即使它似乎没有必要。

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

这导致它崩溃,但仅在我上面描述的情况下,而不是在应用程序委托中设置时。似乎应该允许将阴影颜色设置为清除,尽管你为什么要这样做对我来说并不明显。

于 2014-03-17T23:41:45.217 回答