我正在关注swift的youtube课程,我做了所有相同的事情,但我面对的是线程1:信号SIGABRT
这是代码
我试图创建一个计算器而我只创建数字和结果显示
的ViewController
import UIKit
class ViewController: UIViewController
{
@IBOutlet weak var ResultDisply: UILabel!
@IBAction func AppendDigit(sender: AnyObject) {
let Digit = sender.currentTitle
print("Digit = \(Digit)")
}
}
错误:
016-06-18 22:22:19.783 Calculator[26381:914616] -[Calculator.ViewController aDigit:]: unrecognized selector sent to instance 0x7fb580daaa70
2016-06-18 22:22:19.823 Calculator[26381:914616] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [Calculator.ViewController aDigit:]: unrecognized selector sent to instance 0x7fb580daaa70'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102c00d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001049a4deb objc_exception_throw + 48
2 CoreFoundation 0x0000000102c09d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000102b4fcfa ___forwarding___ + 970
4 CoreFoundation 0x0000000102b4f8a8 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010342aa8d -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x000000010359de67 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x000000010359e143 -[UIControl _sendActionsForEvents:withEvent:] + 327
8 UIKit 0x000000010359d263 -[UIControl touchesEnded:withEvent:] + 601
9 UIKit 0x000000010349d99f -[UIWindow _sendTouchesForEvent:] + 835
10 UIKit 0x000000010349e6d4 -[UIWindow sendEvent:] + 865
11 UIKit 0x0000000103449dc6 -[UIApplication sendEvent:] + 263
12 UIKit 0x0000000103423553 _UIApplicationHandleEventQueue + 6660
13 CoreFoundation 0x0000000102b26301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x0000000102b1c22c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x0000000102b1b6e3 __CFRunLoopRun + 867
16 CoreFoundation 0x0000000102b1b0f8 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000107296ad2 GSEventRunModal + 161
18 UIKit 0x0000000103428f09 UIApplicationMain + 171
19 Calculator 0x0000000102a1c4f2 main + 114
20 libdyld.dylib 0x000000010546892d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
答案 0 :(得分:1)
您的插座连接不正确。 2种可能性:
您的插座未正确连接到代码。转到按钮,cmd +单击以获取操作列表。如果有,则删除它们。然后通过cmd +从按钮拖动到代码重新连接它。
如果没有任何礼物,那就意味着你错过了一个。通过cmd +从按钮拖动到代码重新连接插座。