Ios 错误线程1信号SIGABRT
我正在youtube上为斯威夫特学习一门课程,我做的每一件事都是一样的,但我面对的是第1条线索:信号西格伯特 这是密码 我正在尝试创建一个计算器,我只创建数字和结果显示 视图控制器Ios 错误线程1信号SIGABRT,ios,swift,Ios,Swift,我正在youtube上为斯威夫特学习一门课程,我做的每一件事都是一样的,但我面对的是第1条线索:信号西格伯特 这是密码 我正在尝试创建一个计算器,我只创建数字和结果显示 视图控制器 import UIKit class ViewController: UIViewController { @IBOutlet weak var ResultDisply: UILabel! @IBAction func AppendDigit(sender: AnyObject) {
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)
您的插座连接不正确。2种可能性:
你真的应该发布错误消息,
SIGABRT
就像说“我有一个错误”—甚至不接近任何特定的东西。什么是currentTitle
?请检查下面的错误您在interface builder中未正确设置插座的操作-您已将该操作连接到aDigit
。但是您的实际方法称为AppendDigit
,顺便说一句,它应该是AppendDigit
。谢谢您,它现在可以工作了,