Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 3-线程1:信号SIGABRT未识别选择器发送到实例_Swift_Xcode - Fatal编程技术网

Swift 3-线程1:信号SIGABRT未识别选择器发送到实例

Swift 3-线程1:信号SIGABRT未识别选择器发送到实例,swift,xcode,Swift,Xcode,能帮我解决这个问题吗?我花了几个小时试图解决这个问题,但到目前为止没有任何效果。每次我点击一个按钮,它立即导致错误线程1:信号SIGABRT 这是代码(注意:仍在进行中): 这就是错误: **2017-02-23 07:58:14.194 Tic Tac Toe IS[46707:2457511] -[Tic_Tac_Toe_IS.ViewController ButtonPressed:]: unrecognized selector sent to instance 0x7fb8a8d04e

能帮我解决这个问题吗?我花了几个小时试图解决这个问题,但到目前为止没有任何效果。每次我点击一个按钮,它立即导致错误线程1:信号SIGABRT

这是代码(注意:仍在进行中):

这就是错误:

**2017-02-23 07:58:14.194 Tic Tac Toe IS[46707:2457511] -[Tic_Tac_Toe_IS.ViewController ButtonPressed:]: unrecognized selector sent to instance 0x7fb8a8d04ee0
2017-02-23 07:58:14.202 Tic Tac Toe IS[46707:2457511] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Tic_Tac_Toe_IS.ViewController ButtonPressed:]: unrecognized selector sent to instance 0x7fb8a8d04ee0'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010bebfd4b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00000001092be21e objc_exception_throw + 48
    2   CoreFoundation                      0x000000010bf2ff04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x000000010be45005 ___forwarding___ + 1013
    4   CoreFoundation                      0x000000010be44b88 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x000000010978f8bc -[UIApplication sendAction:to:from:forEvent:] + 83
    6   UIKit                               0x0000000109915c38 -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x0000000109915f51 -[UIControl _sendActionsForEvents:withEvent:] + 444
    8   UIKit                               0x0000000109914e4d -[UIControl touchesEnded:withEvent:] + 668
    9   UIKit                               0x00000001097fd545 -[UIWindow _sendTouchesForEvent:] + 2747
    10  UIKit                               0x00000001097fec33 -[UIWindow sendEvent:] + 4011
    11  UIKit                               0x00000001097ab9ab -[UIApplication sendEvent:] + 371
    12  UIKit                               0x0000000109f9872d __dispatchPreprocessedEventFromEventQueue + 3248
    13  UIKit                               0x0000000109f91463 __handleEventQueue + 4879
    14  CoreFoundation                      0x000000010be64761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    15  CoreFoundation                      0x000000010be4998c __CFRunLoopDoSources0 + 556
    16  CoreFoundation                      0x000000010be48e76 __CFRunLoopRun + 918
    17  CoreFoundation                      0x000000010be48884 CFRunLoopRunSpecific + 420
    18  GraphicsServices                    0x000000010ddf9a6f GSEventRunModal + 161
    19  UIKit                               0x000000010978dc68 UIApplicationMain + 159
    20  Tic Tac Toe IS                      0x0000000108cdb7af main + 111
    21  libdyld.dylib                       0x000000010ce6f68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)** 

你能检查一下@IBAction func ButtonPressed()与情节提要之间的连接吗?您可以从情节提要上的“连接检查器”中进行检查。

您是否使用Interface builder设置了
iAction
方法?从情节提要中删除操作并删除代码,然后读取按钮操作
@iAction func ButtonPressed({sender:Any){}
我将情节提要上的按钮拖到视图控制器mukesh中,我被你的意思弄糊涂了这是我进入连接检查器时屏幕上的内容(我还是一个初学者),我想问题可能是你没有将一个按钮连接到iAction。你能再检查一下吗?我怎么检查?我只将一个按钮连接到iAction,是否有方法连接所有按钮?如果要连接所有按钮,请执行与第一个连接按钮相同的操作。但这就是你想要的吗?(将所有按钮连接到一个iAction?)我希望能够检查是否单击了按钮x(其中所有按钮变量都存储为数组),如果单击了按钮x,则标签x将打印“x”
**2017-02-23 07:58:14.194 Tic Tac Toe IS[46707:2457511] -[Tic_Tac_Toe_IS.ViewController ButtonPressed:]: unrecognized selector sent to instance 0x7fb8a8d04ee0
2017-02-23 07:58:14.202 Tic Tac Toe IS[46707:2457511] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Tic_Tac_Toe_IS.ViewController ButtonPressed:]: unrecognized selector sent to instance 0x7fb8a8d04ee0'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010bebfd4b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00000001092be21e objc_exception_throw + 48
    2   CoreFoundation                      0x000000010bf2ff04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x000000010be45005 ___forwarding___ + 1013
    4   CoreFoundation                      0x000000010be44b88 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x000000010978f8bc -[UIApplication sendAction:to:from:forEvent:] + 83
    6   UIKit                               0x0000000109915c38 -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x0000000109915f51 -[UIControl _sendActionsForEvents:withEvent:] + 444
    8   UIKit                               0x0000000109914e4d -[UIControl touchesEnded:withEvent:] + 668
    9   UIKit                               0x00000001097fd545 -[UIWindow _sendTouchesForEvent:] + 2747
    10  UIKit                               0x00000001097fec33 -[UIWindow sendEvent:] + 4011
    11  UIKit                               0x00000001097ab9ab -[UIApplication sendEvent:] + 371
    12  UIKit                               0x0000000109f9872d __dispatchPreprocessedEventFromEventQueue + 3248
    13  UIKit                               0x0000000109f91463 __handleEventQueue + 4879
    14  CoreFoundation                      0x000000010be64761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    15  CoreFoundation                      0x000000010be4998c __CFRunLoopDoSources0 + 556
    16  CoreFoundation                      0x000000010be48e76 __CFRunLoopRun + 918
    17  CoreFoundation                      0x000000010be48884 CFRunLoopRunSpecific + 420
    18  GraphicsServices                    0x000000010ddf9a6f GSEventRunModal + 161
    19  UIKit                               0x000000010978dc68 UIApplicationMain + 159
    20  Tic Tac Toe IS                      0x0000000108cdb7af main + 111
    21  libdyld.dylib                       0x000000010ce6f68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)**