2010-10-26 74 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

相关问题