代码之家  ›  专栏  ›  技术社区  ›  Jack Bashford

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

  •  0
  • Jack Bashford  · 技术社区  · 6 年前

    我知道这个问题以前被问过很多次,但是用他们的答案得到的所有信息,我的项目还是崩溃了!

    我正在学习应用程序开发,使用iBook介绍应用程序开发与Swift,在苹果的人人可以代码系列。我正在使用第17.3章,这是多个行动和出口,我下面的代码和视频 确切地 Thread 1: signal 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) 
    

    enter image description here enter image description here

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

    请让我知道如果你需要任何更多的信息/代码,我将感谢所有的帮助!

    1 回复  |  直到 6 年前
        1
  •  2
  •   Shehata Gamal    6 年前

    [ColorMix.ViewControllergreenSwitch:]:发送到实例的选择器无法识别

    意味着您已经创建了一个名为 greenSwitch 然后删除它,所以尝试从IB中的开关中删除它,或者在VC中创建该操作

    enter image description here