2012-10-17 53 views
3

當我嘗試通過navcontroller導航到另一個屏幕時,我得到一個NSInternalInconsistencyException。我完全不知道如何處理這個問題,有誰可以幫助我嗎?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

我仔細看了看xib,發現其中一個textviews的顏色被設置爲「黑色」。我將它設置爲「默認」,並且它再次運行。

+0

地獄如何....它的工作! –

0

它與[UITextFieldLabel setTextColor:]不是視圖控制器有關。在代碼中檢查您的文本字段顏色。

+0

我不在代碼中設置textcolor。 xib文件全部使用默認顏色。 – Myth1c

0

這類問題出現在xcode 4.5之後。所以請確保在你的xib文件中有任何未被使用的視圖,然後刪除它。會幫助你們。

相關問題