2016-10-20 35 views
-1

当我点击这个按钮我有错误:按钮ncaught例外

 
2016-10-20 18:33:11.229 FoodTracker[30127:1716662] -[FoodTracker.Rating_controller ratingButtonTapped:]: unrecognized selector sent to instance 0x7f86ac905af0 
2016-10-20 18:33:11.648 FoodTracker[30127:1716662] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FoodTracker.Rating_controller ratingButtonTapped:]: unrecognized selector sent to instance 0x7f86ac905af0' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0000000110d7934b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x000000010e0da21e objc_exception_throw + 48 
    2 CoreFoundation      0x0000000110de8f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 
    3 CoreFoundation      0x0000000110cfec15 ___forwarding___ + 1013 
    4 CoreFoundation      0x0000000110cfe798 _CF_forwarding_prep_0 + 120 
    5 UIKit        0x000000010e5abb88 -[UIApplication sendAction:to:from:forEvent:] + 83 
    6 UIKit        0x000000010e7312b2 -[UIControl sendAction:to:forEvent:] + 67 
    7 UIKit        0x000000010e7315cb -[UIControl _sendActionsForEvents:withEvent:] + 444 
    8 UIKit        0x000000010e72ff83 -[UIControl touchesBegan:withEvent:] + 414 
    9 UIKit        0x000000010e618e15 -[UIWindow _sendTouchesForEvent:] + 2043 
    10 UIKit        0x000000010e61a7c3 -[UIWindow sendEvent:] + 4011 
    11 UIKit        0x000000010e5c7a33 -[UIApplication sendEvent:] + 371 
    12 UIKit        0x000000010edb9b6d __dispatchPreprocessedEventFromEventQueue + 3248 
    13 UIKit        0x000000010edb2817 __handleEventQueue + 4879 
    14 CoreFoundation      0x0000000110d1e311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    15 CoreFoundation      0x0000000110d0359c __CFRunLoopDoSources0 + 556 
    16 CoreFoundation      0x0000000110d02a86 __CFRunLoopRun + 918 
    17 CoreFoundation      0x0000000110d02494 CFRunLoopRunSpecific + 420 
    18 GraphicsServices     0x0000000112c28a6f GSEventRunModal + 161 
    19 UIKit        0x000000010e5a9f34 UIApplicationMain + 159 
    20 FoodTracker       0x000000010daf4a2f main + 111 
    21 libdyld.dylib      0x0000000111ca368d start + 1 
    22 ???         0x0000000000000001 0x0 + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
+1

考虑添加按钮事件处理程序的代码以及与其相关的所有内容。 – alexburtnik

+0

我想你会从'Rating_controller'中删除或重命名'-ratingButtonTapped:'方法。 –

+0

应该有'ratingButtonTapped:'IBAction,它出现在你的xib/storyboard中,但没有在代码 – alexburtnik

回答

0

应该有ratingButtonTapped: IBAction为,这是目前在厦门国际银行的/故事板,但在代码中没有实现。只需选择您的按钮,打开Connections inspector标签:

enter image description here

确保您实现或删除你不实现所有IBActions在类的指定方法。