2010-10-26 46 views
0

我正在將一個簡單視圖推送到NavigationController上。視圖加載正常,當我使用內置的後退按鈕時,它會正常彈出。當我使用UIButton從NavigationController彈出視圖時,應用程序崩潰

但是,當我嘗試在視圖中用我自己的UIButton彈出視圖時,發生崩潰。

這是操作由我的UIButton運行:

-(IBAction)iAgreePressed { 

[[self navigationController] popViewControllerAnimated:YES];} 

我失去的東西在這裏很明顯?

這是錯誤回來在控制檯:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LegalAgreementController iAgreePressed:]: unrecognized selector sent to instance 0x6169190' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x0283ab99 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x0298a40e objc_exception_throw + 47 
    2 CoreFoundation      0x0283c6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x027ac2b6 ___forwarding___ + 966 
    4 CoreFoundation      0x027abe72 _CF_forwarding_prep_0 + 50 
    5 UIKit        0x002d67f8 -[UIApplication sendAction:to:from:forEvent:] + 119 
    6 UIKit        0x00361de0 -[UIControl sendAction:to:forEvent:] + 67 
    7 UIKit        0x00364262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 
    8 UIKit        0x00362e0f -[UIControl touchesEnded:withEvent:] + 458 
    9 UIKit        0x002fa3d0 -[UIWindow _sendTouchesForEvent:] + 567 
    10 UIKit        0x002dbcb4 -[UIApplication sendEvent:] + 447 
    11 UIKit        0x002e09bf _UIApplicationHandleEvent + 7672 
    12 GraphicsServices     0x02f57822 PurpleEventCallback + 1550 
    13 CoreFoundation      0x0281bff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    14 CoreFoundation      0x0277c807 __CFRunLoopDoSource1 + 215 
    15 CoreFoundation      0x02779a93 __CFRunLoopRun + 979 
    16 CoreFoundation      0x02779350 CFRunLoopRunSpecific + 208 
    17 CoreFoundation      0x02779271 CFRunLoopRunInMode + 97 
    18 GraphicsServices     0x02f5600c GSEventRunModal + 217 
    19 GraphicsServices     0x02f560d1 GSEventRun + 115 
    20 UIKit        0x002e4af2 UIApplicationMain + 1160 
    21 WeiglWorksMobileCommander   0x00001fa2 main + 84 
    22 WeiglWorksMobileCommander   0x00001f45 start + 53 
    23 ???         0x00000001 0x0 + 1 
) 
terminate called after throwing an instance of 'NSException' 

謝謝您的時間!

+0

當你崩潰時,你會得到什麼錯誤信息或錯誤代碼? – westsider 2010-10-26 23:34:41

+0

我添加了控制檯錯誤...對不起,這是一團糟。 – DrRocket 2010-10-26 23:57:27

回答

1

方法簽名不匹配。該按鈕發送

-[LegalAgreementController iAgreePressed:] 

但你定義

-[LegalAgreementController iAgreePressed] //(note one arg versus no arg) 

IBActions應該被定義爲:

- (IBAction) someMethod:(id)sender 

你不必嚴格,以包括阿根廷,但要爲一致性。

+0

謝謝,就是這樣! – DrRocket 2010-10-27 00:33:54

相關問題