3

当我尝试通过导航控制器导航到另一个屏幕时,我得到一个 NSInternalInconsistencyException。我完全不知道该怎么办,有人可以帮我吗?

*编辑它在 iOS 6 模拟器上运行良好,但在 iPad 1 4.3 上让我崩溃了。

这是代码片段:

LoginViewController* loginView = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
[self.navigationController pushViewController:loginView animated:YES];

和错误:

*** Assertion failure in -[UITextFieldLabel setTextColor:], /SourceCache/UIKit/UIKit-1448.89/UILabel.m:314
2012-10-20 11:52:54.477 hra[1854:507] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: color'
*** Call stack at first throw:
(
0   CoreFoundation                      0x331a964f __exceptionPreprocess + 114
1   libobjc.A.dylib                     0x35b81c5d objc_exception_throw + 24
2   CoreFoundation                      0x331a9491 +[NSException raise:format:arguments:] + 68
3   Foundation                          0x359d8573 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 62
4   UIKit                               0x32d3f991 -[UILabel setTextColor:] + 96
5   UIKit                               0x32d774df -[UITextField createTextLabelWithTextColor:] + 150
6   UIKit                               0x32e7e925 -[UITextField initWithCoder:] + 344
7   UIKit                               0x32f6d1cf UINibDecoderDecodeObjectForValue + 1646
8   UIKit                               0x32f6d347 -[UINibDecoder decodeObjectForKey:] + 66
9   UIKit                               0x32f0c0bd -[UIRuntimeConnection initWithCoder:] + 88
10  UIKit                               0x32f6d1cf UINibDecoderDecodeObjectForValue + 1646
11  UIKit                               0x32f6cd99 UINibDecoderDecodeObjectForValue + 568
12  UIKit                               0x32f6d347 -[UINibDecoder decodeObjectForKey:] + 66
13  UIKit                               0x32f0b7c7 -[UINib instantiateWithOwner:options:] + 458
14  UIKit                               0x32f0ce09 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
15  UIKit                               0x32e865e9 -[UIViewController _loadViewFromNibNamed:bundle:] + 36
16  UIKit                               0x32e53fa5 -[UIViewController loadView] + 80
17  UIKit                               0x32d38ebf -[UIViewController view] + 30
18  UIKit                               0x32d475ef -[UIViewController contentScrollView] + 22
19  UIKit                               0x32d4745f -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 30
20  UIKit                               0x32d4735d -[UINavigationController _layoutViewController:] + 24
21  UIKit                               0x32d46e35 -[UINavigationController _startTransition:fromViewController:toViewController:] + 380
22  UIKit                               0x32d46c43 -[UINavigationController _startDeferredTransitionIfNeeded] + 182
23  UIKit                               0x32d38d5d -[UINavigationController pushViewController:transition:forceImmediate:] + 640
24  UIKit                               0x32d38ad3 -[UINavigationController pushViewController:animated:] + 34
25  hra                                 0x000102d9 -[MainMenuController goToLoginScreenButtonPressed:] + 156
26  CoreFoundation                      0x33119571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
27  UIKit                               0x32d1eec9 -[UIApplication sendAction:to:from:forEvent:] + 84
28  UIKit                               0x32d1ee69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
29  UIKit                               0x32d1ee3b -[UIControl sendAction:to:forEvent:] + 38
30  UIKit                               0x32d1eb8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
31  UIKit                               0x32d1f423 -[UIControl touchesEnded:withEvent:] + 342
32  UIKit                               0x32d1dbf5 -[UIWindow _sendTouchesForEvent:] + 368
33  UIKit                               0x32d1d56f -[UIWindow sendEvent:] + 262
34  UIKit                               0x32d06313 -[UIApplication sendEvent:] + 298
35  UIKit                               0x32d05c53 _UIApplicationHandleEvent + 5090
36  GraphicsServices                    0x35fdee77 PurpleEventCallback + 666
37  CoreFoundation                      0x33180a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
38  CoreFoundation                      0x3318283f __CFRunLoopDoSource1 + 166
39  CoreFoundation                      0x3318360d __CFRunLoopRun + 520
40  CoreFoundation                      0x33113ec3 CFRunLoopRunSpecific + 230
41  CoreFoundation                      0x33113dcb CFRunLoopRunInMode + 58
42  GraphicsServices                    0x35fde41f GSEventRunModal + 114
43  GraphicsServices                    0x35fde4cb GSEventRun + 62
44  UIKit                               0x32d30d69 -[UIApplication _run] + 404
45  UIKit                               0x32d2e807 UIApplicationMain + 670
46  hra                                 0x00002bdb main + 158
47  hra                                 0x00002b38 start + 40
)
terminate called after throwing an instance of 'NSException'

如果需要更多信息,请询问,我会尽我所能。

4

3 回答 3

4

我仔细查看了 xib,发现我的一个文本视图的颜色设置为“黑色”。我将其设置为“默认”,一切都再次起作用。

于 2012-10-17T11:12:31.127 回答
0

这种问题发生在 xcode 4.5 以后。因此,请确保在您的 xib 文件中,如果有任何未使用的视图,则将其删除。会帮助你们。

于 2013-01-15T08:38:32.410 回答
0

它与[UITextFieldLabel setTextColor:]非视图控制器有关。检查代码中的文本字段颜色。

于 2012-10-17T10:17:59.460 回答