与iPad有关的NIB相关崩溃但不是iPhone

时间:2011-04-02 16:15:16

标签: iphone ios ipad exception xib

我遇到了一个问题,我希望你可以帮助我。

当我尝试在iPad上运行时,我的应用程序(专为iPhone而非iPad制作)已经开始崩溃。我收到这条消息:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 
'[<UIApplication 0x11f0b0> setValue:forUndefinedKey:]: this class is not key value 
coding-compliant for the key firstLineField.'

firstLineField是一个位于XIB文件中的UITextField。在我的任何代码运行之前,堆栈显示[UIApplication _loadMainNibFile]已调用此函数。你们有什么想法可能会发生什么吗?

感谢您的帮助,

附录:这是我的堆栈跟踪。

#0  0x3286ca1c in __pthread_kill
#1  0x304a33ba in pthread_kill
#2  0x3049bbfe in abort
#3  0x35d09a6a in __gnu_cxx::__verbose_terminate_handler
#4  0x365f9072 in _objc_terminate
#5  0x35d07e3c in __cxxabiv1::__terminate
#6  0x35d07e90 in std::terminate
#7  0x35d07f60 in __cxa_throw
#8  0x365f7c8a in objc_exception_throw
#9  0x358a43cc in -[NSException raise]
#10 0x351f3eda in -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:]
#11 0x351ac9ca in _NSSetUsingKeyValueSetter
#12 0x351ac216 in -[NSObject(NSKeyValueCoding) setValue:forKey:]
#13 0x3518e42e in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
#14 0x3219b8de in -[UIRuntimeOutletConnection connect]
#15 0x3583cd7a in -[NSObject(NSObject) performSelector:]
#16 0x3583c99c in -[NSArray makeObjectsPerformSelector:]
#17 0x3219a846 in -[UINib instantiateWithOwner:options:]
#18 0x3219be08 in -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:]
#19 0x31fc64cc in -[UIApplication _loadMainNibFile]
#20 0x31fc0b08 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:]
#21 0x31f957d6 in -[UIApplication handleEvent:withNewEvent:]
#22 0x31f95214 in -[UIApplication sendEvent:]
#23 0x31f94c52 in _UIApplicationHandleEvent
#24 0x31e6be76 in PurpleEventCallback
#25 0x3587ba96 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
#26 0x3587d83e in __CFRunLoopDoSource1
#27 0x3587e60c in __CFRunLoopRun
#28 0x3580eec2 in CFRunLoopRunSpecific
#29 0x3580edca in CFRunLoopRunInMode
#30 0x31fbfd48 in -[UIApplication _run]
#31 0x31fbd806 in UIApplicationMain
#32 0x0000294e in main at main.m:13

1 个答案:

答案 0 :(得分:0)

您有UITextField已连接到名为firstLineField的商店属性,但在控制器中找不到此属性。

检查控制器类中是否实际定义了firstLineField属性。