2016-10-20 56 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在類的指定方法。