Swift Error during run

2018-03-03 17:17:52.710766-0500 Chewculator[13847:363499] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Chewculator.ViewController 0x7ff2e3c07f10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key allclearPressed.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ac3712b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000106830f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010ac37079 -[NSException raise] + 9
3 Foundation 0x000000010624fa63 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x0000000107980117 -[UIViewController setValue:forKey:] + 87
5 UIKit 0x0000000107c71c2d -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010abda3cd -[NSArray makeObjectsPerformSelector:] + 317
7 UIKit 0x0000000107c705e3 -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x00000001079873ff -[UIViewController _loadViewFromNibNamed:bundle:] + 383
9 UIKit 0x0000000107987d2b -[UIViewController loadView] + 177
10 UIKit 0x000000010798805c -[UIViewController loadViewIfRequired] + 195
11 UIKit 0x00000001079888b9 -[UIViewController view] + 27
12 UIKit 0x00000001078537cf -[UIWindow addRootViewControllerViewIfPossible] + 122
13 UIKit 0x0000000107853ed7 -[UIWindow _setHidden:forced:] + 294
14 UIKit 0x0000000107866e54 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x00000001077d98b8 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4737
16 UIKit 0x00000001077deaeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
17 UIKit 0x0000000107ba86f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
18 UIKit 0x0000000107f7e4c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
19 UIKit 0x0000000107ba82f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
20 UIKit 0x0000000107ba8b6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
21 UIKit 0x0000000108526a69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
22 UIKit 0x0000000108526922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
23 UIKit 0x00000001082039c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
24 UIKit 0x0000000108402b06 _performActionsWithDelayForTransitionContext + 100
25 UIKit 0x000000010820388b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
26 UIKit 0x0000000107f7db25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
27 UIKit 0x00000001077dd36a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
28 UIKit 0x0000000107db8605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
29 FrontBoardServices 0x000000010dca1cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
30 FrontBoardServices 0x000000010dcaa7b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
31 libdispatch.dylib 0x000000010be5f33d _dispatch_client_callout + 8
32 libdispatch.dylib 0x000000010be649f3 _dispatch_block_invoke_direct + 592
33 FrontBoardServices 0x000000010dcd6498 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24
34 FrontBoardServices 0x000000010dcd614e -[FBSSerialQueue _performNext] + 464
35 FrontBoardServices 0x000000010dcd66bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
36 CoreFoundation 0x000000010abda101 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
37 CoreFoundation 0x000000010ac79f71 __CFRunLoopDoSource0 + 81
38 CoreFoundation 0x000000010abbea19 __CFRunLoopDoSources0 + 185
39 CoreFoundation 0x000000010abbdfff __CFRunLoopRun + 1279
40 CoreFoundation 0x000000010abbd889 CFRunLoopRunSpecific + 409
41 GraphicsServices 0x000000010e56a9c6 GSEventRunModal + 62
42 UIKit 0x00000001077e05d6 UIApplicationMain + 159
43 Chewculator 0x0000000105f175f7 main + 55
44 libdyld.dylib 0x000000010bcb2d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

I think this issue is here but as a beginner I am confused as to how to fix it.37%20PM

Sounds like you have a UIKit question. StackOverflow (or Apple Developer forums?) might be a better forum to get an answer, as UIKit isn’t part of the Swift project.

1 Like

Look at “func numberFuncPressed”. see “@IBAction” in front of it? What does that do?

Now look at “func allclearPressed”. it doesn’t have “@IBAction” in front of it. Should it? The name is also not capitalizing “Clear”. Swift is a case sensitive language, so if some other code expects to call “allClearPressed”, it’s not going to work.

C. Keith Ray

https://leanpub.com/wepntk <- buy my book?

http://agilesolutionspace.blogspot.com/

twitter: @ckeithray

http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf

Ok, thank you.