unrecognized selector sent to instance

when I run this project,It crashed in AppDelegate.swift at "class AppDelegate: UIResponder, UIApplicationDelegate"

error message :


Optional(<UIButton: 0x7ff76e51d090; frame = (0 0; 49 42); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x6000008b5140>>)

2019-04-06 13:33:16.057133+0800 IRIS iOS[86863:2645289] -[UIView setConstant:]: unrecognized selector sent to instance 0x7ff76e700a50

2019-04-06 13:33:16.063175+0800 IRIS iOS[86863:2645289] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setConstant:]: unrecognized selector sent to instance 0x7ff76e700a50'

*** First throw call stack:

(

0 CoreFoundation 0x00000001089b46fb __exceptionPreprocess + 331

1 libobjc.A.dylib 0x0000000107f58ac5 objc_exception_throw + 48

2 CoreFoundation 0x00000001089d2ab4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132

3 UIKitCore 0x0000000113e42c3d -[UIResponder doesNotRecognizeSelector:] + 287

4 CoreFoundation 0x00000001089b9443 ___forwarding___ + 1443

5 CoreFoundation 0x00000001089bb238 _CF_forwarding_prep_0 + 120

6 IRIS iOS 0x00000001074f2f1a $s8IRIS_iOS20SecondViewControllerC12isProcessingSbvW + 1418

7 IRIS iOS 0x00000001074f34c2 $s8IRIS_iOS20SecondViewControllerC12isProcessingSbvs + 274

8 IRIS iOS 0x00000001074f3637 $s8IRIS_iOS20SecondViewControllerC11viewDidLoadyyF + 151

9 IRIS iOS 0x00000001074f3844 $s8IRIS_iOS20SecondViewControllerC11viewDidLoadyyFTo + 36

10 UIKitCore 0x000000011381443b -[UIViewController loadViewIfRequired] + 1183

11 UIKitCore 0x0000000113814868 -[UIViewController view] + 27

12 UIKitCore 0x0000000113e4cc33 -[UIWindow addRootViewControllerViewIfPossible] + 122

13 UIKitCore 0x0000000113e4d327 -[UIWindow _setHidden:forced:] + 289

14 UIKitCore 0x0000000113e5ff86 -[UIWindow makeKeyAndVisible] + 42

15 UIKitCore 0x0000000113e0ff1c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555

16 UIKitCore 0x0000000113e150c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617

17 UIKitCore 0x000000011365a6d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904

18 UIKitCore 0x0000000113662fce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153

19 UIKitCore 0x000000011365a2ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236

20 UIKitCore 0x000000011365ac48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091

21 UIKitCore 0x0000000113658fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782

22 UIKitCore 0x0000000113658c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433

23 UIKitCore 0x000000011365d9b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576

24 UIKitCore 0x000000011365e610 _performActionsWithDelayForTransitionContext + 100

25 UIKitCore 0x000000011365d71d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223

26 UIKitCore 0x00000001136626d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392

27 UIKitCore 0x0000000113e139a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514

28 UIKitCore 0x00000001139cadfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361

29 FrontBoardServices 0x0000000112b4b125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448

30 FrontBoardServices 0x0000000112b54ed6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283

31 FrontBoardServices 0x0000000112b54700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53

32 libdispatch.dylib 0x000000010c77adb5 _dispatch_client_callout + 8

33 libdispatch.dylib 0x000000010c77e2ba _dispatch_block_invoke_direct + 300

34 FrontBoardServices 0x0000000112b86146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30

35 FrontBoardServices 0x0000000112b85dfe -[FBSSerialQueue _performNext] + 451

36 FrontBoardServices 0x0000000112b86393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42

37 CoreFoundation 0x000000010891bbe1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17

38 CoreFoundation 0x000000010891b463 __CFRunLoopDoSources0 + 243

39 CoreFoundation 0x0000000108915b1f __CFRunLoopRun + 1231

40 CoreFoundation 0x0000000108915302 CFRunLoopRunSpecific + 626

41 GraphicsServices 0x000000010f9a12fe GSEventRunModal + 65

42 UIKitCore 0x0000000113e16ba2 UIApplicationMain + 140

43 IRIS iOS 0x000000010751735b main + 75

44 libdyld.dylib 0x000000010c7ef541 start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException



Can someone please explain this, or at least, tell me what I need to write to get it correct?


All suggestions would be great!


Thanks.


The error may be outside appdelegate ; it is only the place where it is reported.


Did you define target actions ?

If so, show the code for:

the call : addTarget(self, action:)

the action nyou've defined


Could be that the way you define the action in addTarget does not match IBAction signature (extra colon for instance)

Was this question solved ?

unrecognized selector sent to instance
 
 
Q