无法识别的选择器发送到实例***

问题描述 投票:0回答:1

当我运行该项目时,它崩溃在“AppDelegate.swift”。

错误消息:

Optional(<UIButton: 0x7f9a0bd06610; frame = (0 0; 49 42); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x600001a316a0>>)
2019-04-07 11:10:54.335048+0800 IRIS iOS[60993:2979677] -[UIView setConstant:]: unrecognized selector sent to instance 0x7f9a0bd247f0
2019-04-07 11:10:54.351958+0800 IRIS iOS[60993:2979677] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setConstant:]: unrecognized selector sent to instance 0x7f9a0bd247f0'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001044ce6fb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x0000000103a72ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001044ecab4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   UIKitCore                           0x000000010f950c3d -[UIResponder doesNotRecognizeSelector:] + 287
    4   CoreFoundation                      0x00000001044d3443 ___forwarding___ + 1443
    5   CoreFoundation                      0x00000001044d5238 _CF_forwarding_prep_0 + 120
    6   IRIS iOS                            0x000000010300cf1a $s8IRIS_iOS20SecondViewControllerC12isProcessingSbvW + 1418
    7   IRIS iOS                            0x000000010300d4c2 $s8IRIS_iOS20SecondViewControllerC12isProcessingSbvs + 274
    8   IRIS iOS                            0x000000010300d637 $s8IRIS_iOS20SecondViewControllerC11viewDidLoadyyF + 151
    9   IRIS iOS                            0x000000010300d844 $s8IRIS_iOS20SecondViewControllerC11viewDidLoadyyFTo + 36
    10  UIKitCore                           0x000000010f32243b -[UIViewController loadViewIfRequired] + 1183
    11  UIKitCore                           0x000000010f322868 -[UIViewController view] + 27
    12  UIKitCore                           0x000000010f95ac33 -[UIWindow addRootViewControllerViewIfPossible] + 122
    13  UIKitCore                           0x000000010f95b327 -[UIWindow _setHidden:forced:] + 289
    14  UIKitCore                           0x000000010f96df86 -[UIWindow makeKeyAndVisible] + 42
    15  UIKitCore                           0x000000010f91df1c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555
    16  UIKitCore                           0x000000010f9230c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
    17  UIKitCore                           0x000000010f1686d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
    18  UIKitCore                           0x000000010f170fce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
    19  UIKitCore                           0x000000010f1682ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
    20  UIKitCore                           0x000000010f168c48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
    21  UIKitCore                           0x000000010f166fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
    22  UIKitCore                           0x000000010f166c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
    23  UIKitCore                           0x000000010f16b9b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
    24  UIKitCore                           0x000000010f16c610 _performActionsWithDelayForTransitionContext + 100
    25  UIKitCore                           0x000000010f16b71d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
    26  UIKitCore                           0x000000010f1706d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
    27  UIKitCore                           0x000000010f9219a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
    28  UIKitCore                           0x000000010f4d8dfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
    29  FrontBoardServices                  0x000000010d982125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
    30  FrontBoardServices                  0x000000010d98bed6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
    31  FrontBoardServices                  0x000000010d98b700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
    32  libdispatch.dylib                   0x0000000108294db5 _dispatch_client_callout + 8
    33  libdispatch.dylib                   0x00000001082982ba _dispatch_block_invoke_direct + 300
    34  FrontBoardServices                  0x000000010d9bd146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
    35  FrontBoardServices                  0x000000010d9bcdfe -[FBSSerialQueue _performNext] + 451
    36  FrontBoardServices                  0x000000010d9bd393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
    37  CoreFoundation                      0x0000000104435be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    38  CoreFoundation                      0x0000000104435463 __CFRunLoopDoSources0 + 243
    39  CoreFoundation                      0x000000010442fb1f __CFRunLoopRun + 1231
    40  CoreFoundation                      0x000000010442f302 CFRunLoopRunSpecific + 626
    41  GraphicsServices                    0x000000010b4bb2fe GSEventRunModal + 65
    42  UIKitCore                           0x000000010f924ba2 UIApplicationMain + 140
    43  IRIS iOS                            0x000000010303135b main + 75
    44  libdyld.dylib                       0x0000000108309541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

有人可以解释一下,或者至少告诉我需要写什么才能使它正确无误?

ios swift unrecognized-selector
1个回答
0
投票

它的意思是你创建了一个按钮,但它的选择器方法还没有创建。

© www.soinside.com 2019 - 2024. All rights reserved.