我需要帮助阅读Xcode的错误控制台

时间:2017-05-09 02:19:42

标签: swift xcode sigabrt

我是Xcode的初学者,我在阅读错误控制台时无法解决任何导致我的应用崩溃的问题。我的代码(Swift)编译,但我得到了SIGABRT错误,我已经看到了很多其他线程。对于每个问题,似乎解决方案都非常不同。

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

1 个答案:

答案 0 :(得分:1)

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

这是您需要关注的内容。根据这个,你的项目“ChordGenerator”有一个文件“ViewController”有一些功能,你传递一个选择器“newChordButton”。目前,系统无法找到该功能。总而言之,传递一个存在于目标范围内的函数 name ,即如果target = self,那么函数newChordButton必须在当前的ViewController.swift类中。

如果您正在测试,只需创建一个空函数:

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