2017-05-09 45 views
0

我是一個Xcode初學者,並且在閱讀錯誤控制檯時無法解決導致我的應用崩潰的任何問題。我的代碼(Swift)編譯,但我得到了我見過很多其他線程的SIGABRT錯誤。看起來解決方案對於每個問題都非常不同。我需要幫助閱讀Xcode的錯誤控制檯

2017-05-08 20:57:32.821 ChordGenerator[6335:422217] -[ChordGenerator.ViewController newChordButton:]: unrecognized selector sent to instance 0x7f9ec6407fd0 
2017-05-08 20:57:32.825 ChordGenerator[6335:422217] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ChordGenerator.ViewController newChordButton:]: unrecognized selector sent to instance 0x7f9ec6407fd0' 
*** First throw call stack: 
(
    0 CoreFoundation      0x000000010b0beb0b __exceptionPreprocess + 171 
    1 libobjc.A.dylib      0x000000010828b141 objc_exception_throw + 48 
    2 CoreFoundation      0x000000010b12e134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 
    3 CoreFoundation      0x000000010b045840 ___forwarding___ + 1024 
    4 CoreFoundation      0x000000010b0453b8 _CF_forwarding_prep_0 + 120 
    5 UIKit        0x0000000108f87d22 -[UIApplication sendAction:to:from:forEvent:] + 83 
    6 UIKit        0x000000010910c25c -[UIControl sendAction:to:forEvent:] + 67 
    7 UIKit        0x000000010910c577 -[UIControl _sendActionsForEvents:withEvent:] + 450 
    8 UIKit        0x000000010910b4b2 -[UIControl touchesEnded:withEvent:] + 618 
    9 UIKit        0x0000000108ff549a -[UIWindow _sendTouchesForEvent:] + 2707 
    10 UIKit        0x0000000108ff6bb0 -[UIWindow sendEvent:] + 4114 
    11 UIKit        0x0000000108fa37b0 -[UIApplication sendEvent:] + 352 
    12 UIKit        0x0000000109786adc __dispatchPreprocessedEventFromEventQueue + 2926 
    13 UIKit        0x000000010977ea3a __handleEventQueue + 1122 
    14 CoreFoundation      0x000000010b064c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    15 CoreFoundation      0x000000010b04a0cf __CFRunLoopDoSources0 + 527 
    16 CoreFoundation      0x000000010b0495ff __CFRunLoopRun + 911 
    17 CoreFoundation      0x000000010b049016 CFRunLoopRunSpecific + 406 
    18 GraphicsServices     0x000000010cf7ba24 GSEventRunModal + 62 
    19 UIKit        0x0000000108f860d4 UIApplicationMain + 159 
    20 ChordGenerator      0x0000000107cb06a7 main + 55 
    21 libdyld.dylib      0x000000010c01065d start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
+0

'SIGABRT'只意味着它是一個'SIG'nal該進程'AB'o'RT'。看看錯誤的前兩行,也許這會給錯誤的根源提供一些提示。 – Jerrybibo

+0

這是'reason:'的問題 - [ChordGenerator.ViewController newChordButton:]:'。 「newChordButton」方法不存在,或者該類不符合此方法。 – nayem

+0

修復您的按鈕操作,使其指向視圖控制器中的有效方法。 – rmaddy

回答

1

2017-05-08 20:57:32.821 ChordGenerator[6335:422217] -[ChordGenerator.ViewController newChordButton:]: unrecognized selector sent to instance 0x7f9ec6407fd0

這是你需要關注就行了。據此,具有文件「ViewController」的項目「ChordGenerator」具有一些你傳遞選擇器「newChordButton」的函數。目前,系統無法找到該功能。總而言之,傳遞函數名稱存在於目標範圍內,即如果target = self,則函數newChordButton必須存在於當前ViewController.swift類中。

如果您正在測試,只是讓一個空函數:

func newChordButton(){ print("Entered newChordButton function") }