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

标签 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

最佳答案

2017-05-08 20:57:32.821 ChordGenerator[6335:422217] -[ChordGenerator.ViewController newChordButton:]: 无法识别的选择器发送到实例 0x7f9ec6407fd0

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

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

函数 newChordButton(){ print("输入了新的ChordButton函数") }

关于swift - 我需要帮助阅读 Xcode 的错误控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43860004/

相关文章:

ios - 具有完全不同布局的通用应用程序

swift - 类不符合包含默认实现的扩展的协议(protocol)

ios - 通过保留透明区域并移除彩色区域来使用 UIImage mask UIView

ios - 删除核心数据元素

ios - 如何在 Storyboard中更改 View Controller 的标题

ios - 在编辑器中播放 Xcode Simulator 动画时速度极慢

swift - Xcode New "Run Script Phase"- 如何处理输出文件?

ios - 线程 1 : signal SIGABRT (Tried prev solutions)

android - NestedScrollView 中的 WebView 给出致命信号 6 (SIGABRT) 代码 -6 RenderThread

c++ - 间歇性 "Aborted Core Dumped"。也许是 static_cast 的错?