Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.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
Ios Swift应用程序开发错误-线程1信号SIGABRT_Ios_Swift_Xcode_Sigabrt - Fatal编程技术网

Ios Swift应用程序开发错误-线程1信号SIGABRT

Ios Swift应用程序开发错误-线程1信号SIGABRT,ios,swift,xcode,sigabrt,Ios,Swift,Xcode,Sigabrt,我知道这个问题以前被问过很多次,但是使用从他们的答案中获得的所有信息,我的项目仍然崩溃 我正在学习应用程序开发,在苹果的“人人都可以编写代码”系列中,使用iBook简介和Swift进行应用程序开发。我使用的是第17.3章,这是多个动作和出口,我严格遵循代码和视频如图所示,但是,当我轻弹第一个开关时,视图对象应该变成红色,但它没有,轻弹另外两个开关会使应用程序崩溃,错误为线程1:SIGABRT。控制台错误如下: 2018-09-06 18:29:35.503697+1000 ColorMix[26

我知道这个问题以前被问过很多次,但是使用从他们的答案中获得的所有信息,我的项目仍然崩溃

我正在学习应用程序开发,在苹果的“人人都可以编写代码”系列中,使用iBook简介和Swift进行应用程序开发。我使用的是第17.3章,这是多个动作和出口,我严格遵循代码和视频如图所示,但是,当我轻弹第一个开关时,视图对象应该变成红色,但它没有,轻弹另外两个开关会使应用程序崩溃,错误为
线程1:SIGABRT
。控制台错误如下:

2018-09-06 18:29:35.503697+1000 ColorMix[2654:141233] -[ColorMix.ViewController greenSwitch:]: unrecognized selector sent to instance 0x7f89a4c09110
2018-09-06 18:29:35.515103+1000 ColorMix[2654:141233] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ColorMix.ViewController greenSwitch:]: unrecognized selector sent to instance 0x7f89a4c09110'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001113a81e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x000000010f9ce031 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000111429784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   UIKit                               0x0000000111d5e6db -[UIResponder doesNotRecognizeSelector:] + 295
    4   CoreFoundation                      0x000000011132a898 ___forwarding___ + 1432
    5   CoreFoundation                      0x000000011132a278 _CF_forwarding_prep_0 + 120
    6   UIKit                               0x0000000111b313e8 -[UIApplication sendAction:to:from:forEvent:] + 83
    7   UIKit                               0x0000000111cac7a4 -[UIControl sendAction:to:forEvent:] + 67
    8   UIKit                               0x0000000111cacac1 -[UIControl _sendActionsForEvents:withEvent:] + 450
    9   UIKit                               0x00000001127edea0 -[UISwitchModernVisualElement sendStateChangeActions] + 73
    10  UIKit                               0x00000001121af9d3 -[UISwitchMVEGestureTrackingSession _sendStateChangeActionsIfNecessary] + 63
    11  UIKit                               0x00000001127ee62c -[UISwitchModernVisualElement _handleLongPressWithGestureLocationInBounds:gestureState:] + 760
    12  UIKit                               0x000000011212854f -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
    13  UIKit                               0x0000000112131324 _UIGestureRecognizerSendTargetActions + 109
    14  UIKit                               0x000000011212eb6c _UIGestureRecognizerSendActions + 307
    15  UIKit                               0x000000011212ddc0 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 859
    16  UIKit                               0x0000000112112e24 _UIGestureEnvironmentUpdate + 1329
    17  UIKit                               0x00000001121128a7 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 484
    18  UIKit                               0x00000001121119a9 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 281
    19  UIKit                               0x0000000111ba77ab -[UIWindow sendEvent:] + 4064
    20  UIKit                               0x0000000111b4b310 -[UIApplication sendEvent:] + 352
    21  UIKit                               0x000000011248c6af __dispatchPreprocessedEventFromEventQueue + 2796
    22  UIKit                               0x000000011248f2c4 __handleEventQueueInternal + 5949
    23  CoreFoundation                      0x000000011134abb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    24  CoreFoundation                      0x000000011132f4af __CFRunLoopDoSources0 + 271
    25  CoreFoundation                      0x000000011132ea6f __CFRunLoopRun + 1263
    26  CoreFoundation                      0x000000011132e30b CFRunLoopRunSpecific + 635
    27  GraphicsServices                    0x0000000115efea73 GSEventRunModal + 62
    28  UIKit                               0x0000000111b30057 UIApplicationMain + 159
    29  ColorMix                            0x000000010f0c2a67 main + 55
    30  libdyld.dylib                       0x00000001147ec955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
以下是我的ViewController和Main.storyboard文件的屏幕截图:

此外,在我的应用程序崩溃后,一些奇怪的事情发生了:在第33行和第48行创建了新的门店(填充的点),其中没有任何与门店相关的内容

如果您需要更多信息/代码,请告诉我,我将非常感谢您的帮助

这个

[ColorMix.ViewController绿色开关:]:发送到实例的选择器无法识别

这意味着您已经创建了一个名为
greenSwitch
的iAction,然后将其删除,因此请尝试将其从IB中的开关中删除,或者在VC中创建该操作

这个

[ColorMix.ViewController绿色开关:]:发送到实例的选择器无法识别

这意味着您已经创建了一个名为
greenSwitch
的iAction,然后将其删除,因此请尝试将其从IB中的开关中删除,或者在VC中创建该操作


复制/粘贴代码,而不是代码的屏幕截图。此外,在故事板上,选择您的ViewController(位于“视图控制器场景”和“视图”之间的“视图控制器”)。在右侧面板上,向我们显示您选择最后一个面板时的屏幕截图(显示连接检查器)。您最初是否有一个名为
@IBAction func greenSwitch(u-sender:UISwitch)
或类似的方法?请检查情节提要中是否包含附加到元素的任何不需要的IBAction。您可以与我们共享演示代码吗?演示代码是什么意思?书籍代码?复制/粘贴代码,而不是代码的屏幕截图。此外,在故事板上,选择您的ViewController(位于“视图控制器场景”和“视图”之间的“视图控制器”)。在右侧面板上,向我们显示您选择最后一个面板时的屏幕截图(显示连接检查器)。您最初是否有一个名为
@IBAction func greenSwitch(u-sender:UISwitch)
或类似的方法?请检查情节提要中是否包含附加到元素的任何不需要的IBAction。您可以与我们共享演示代码吗?演示代码是什么意思?书籍代码?那么我应该删除您突出显示的绿色框中的项目吗?注意,您应该删除“值更改”链接,而不是引用出口(在@Sh_Khan answer中没有那么清楚)。单击x以删除它。我应该删除您突出显示的绿色框中的项目吗?注意,您应该删除“值更改”链接,不是引用插座(在@Sh_Khan answer中不太清楚)。单击x将其删除