2011-01-07 276 views
0

首先,我想說我是一個iPhone開發的總新手,並且可能存在一個明顯的缺失。每當按下按鈕時,應用程序崩潰

我有一個基於視圖的應用程序。我進入了「MainWindow.xib」,並將「Nib Name」更改爲「MainMenu」,即我應用菜單的xib的名稱。我有一個按鈕,連接到一個動作(showWordChooser),每當按下按鈕時,應用程序崩潰。

調試內容:

2011-01-07 15:56:01.987 NCEAVerbs[20479:207] -[NCEAVerbsViewController showWordChooser]: unrecognized selector sent to instance 0x4b251c0 
2011-01-07 15:56:01.990 NCEAVerbs[20479:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NCEAVerbsViewController showWordChooser]: unrecognized selector sent to instance 0x4b251c0' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x00da7be9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x00efc5c2 objc_exception_throw + 47 
    2 CoreFoundation      0x00da96fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x00d19366 ___forwarding___ + 966 
    4 CoreFoundation      0x00d18f22 _CF_forwarding_prep_0 + 50 
    5 UIKit        0x00012a6e -[UIApplication sendAction:to:from:forEvent:] + 119 
    6 UIKit        0x000a11b5 -[UIControl sendAction:to:forEvent:] + 67 
    7 UIKit        0x000a3647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 
    8 UIKit        0x000a21f4 -[UIControl touchesEnded:withEvent:] + 458 
    9 UIKit        0x000370d1 -[UIWindow _sendTouchesForEvent:] + 567 
    10 UIKit        0x0001837a -[UIApplication sendEvent:] + 447 
    11 UIKit        0x0001d732 _UIApplicationHandleEvent + 7576 
    12 GraphicsServices     0x0101ca36 PurpleEventCallback + 1550 
    13 CoreFoundation      0x00d89064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    14 CoreFoundation      0x00ce96f7 __CFRunLoopDoSource1 + 215 
    15 CoreFoundation      0x00ce6983 __CFRunLoopRun + 979 
    16 CoreFoundation      0x00ce6240 CFRunLoopRunSpecific + 208 
    17 CoreFoundation      0x00ce6161 CFRunLoopRunInMode + 97 
    18 GraphicsServices     0x0101b268 GSEventRunModal + 217 
    19 GraphicsServices     0x0101b32d GSEventRun + 115 
    20 UIKit        0x0002142e UIApplicationMain + 1160 
    21 NCEAVerbs       0x00001b64 main + 102 
    22 NCEAVerbs       0x00001af5 start + 53 
) 
terminate called after throwing an instance of 'NSException' 
sharedlibrary apply-load-rules all 

,如果我做一個BT:

(gdb) bt 
#0 0x90a16176 in __kill() 
#1 0x90a16168 in kill$UNIX2003() 
#2 0x90aa889d in raise() 
#3 0x90abe9bc in abort() 
#4 0x99a16fba in __gnu_cxx::__verbose_terminate_handler() 
#5 0x00efc4e7 in _objc_terminate() 
#6 0x99a1515a in __cxxabiv1::__terminate() 
#7 0x99a1519a in std::terminate() 
#8 0x99a15298 in __cxa_throw() 
#9 0x00efc635 in objc_exception_throw() 
#10 0x00da96fb in -[NSObject(NSObject) doesNotRecognizeSelector:]() 
#11 0x00d19366 in ___forwarding___() 
#12 0x00d18f22 in __forwarding_prep_0___() 
#13 0x00012a6e in -[UIApplication sendAction:to:from:forEvent:]() 
#14 0x000a11b5 in -[UIControl sendAction:to:forEvent:]() 
#15 0x000a3647 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]() 
#16 0x000a21f4 in -[UIControl touchesEnded:withEvent:]() 
#17 0x000370d1 in -[UIWindow _sendTouchesForEvent:]() 
#18 0x0001837a in -[UIApplication sendEvent:]() 
#19 0x0001d732 in _UIApplicationHandleEvent() 
#20 0x0101ca36 in PurpleEventCallback() 
#21 0x00d89064 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__() 
#22 0x00ce96f7 in __CFRunLoopDoSource1() 
#23 0x00ce6983 in __CFRunLoopRun() 
#24 0x00ce6240 in CFRunLoopRunSpecific() 
#25 0x00ce6161 in CFRunLoopRunInMode() 
#26 0x0101b268 in GSEventRunModal() 
#27 0x0101b32d in GSEventRun() 
#28 0x0002142e in UIApplicationMain() 
#29 0x00001b64 in main (argc=1, argv=0xbffff08c) at /Developer/Projects/NCEAVerbs/NCEAVerbs-main.m:13 
(gdb) 

我真的不知道發生了什麼事,請幫助:)

+0

如果你改變了筆尖名稱,可能還需要更改類名稱。 – Veeru 2011-01-07 03:40:01

回答

8
-[NCEAVerbsViewController showWordChooser]: unrecognized selector sent to instance 0x4b251c0 

你顯然試圖打電話showWordChooser某處,這是不存在於你打電話的位置。

1

的錯誤意味着你的天堂」定義了該方法。檢查拼寫錯誤的方法名稱,或者是否將函數放在錯誤的文件中?

+0

我在MainMenu.h/m中放置了這個動作...它會拼錯在哪裏?它只在MainMenu.h中引用&m – JJJollyjim 2011-01-07 03:08:44

+0

它必須位於NCEAVerbsViewController.h/.m – 2011-01-07 03:14:58

相關問題