我是一个Xcode初学者,在阅读错误控制台以修复导致我的应用程序崩溃的问题时遇到了困难。我的代码(Swift)编译了,但是我得到了sigabret错误,我已经看到很多其他线程了。似乎每个问题的解决方案都大不相同。
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:]: unrecognized selector sent to instance 0x7f9ec6407fd0
这是你需要关注的问题。根据这一点,您的项目“ChordGenerator”有一个文件“ViewController”,它有一个您正在传递选择器“newChordButton”的函数。当前,系统找不到该函数。总而言之,传递一个在目标范围内存在的函数名称,即如果目标=SUM,那么函数NeXCHONTRONK必须在当前VIEWCONDER。SWIFT类中。
如果您正在测试,只需使一个空函数:func newChordButton(){ print("Entered newChordButton function")}