This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 4 years ago.
as mentioned above, during one of the courses I am taking, when I run my project, the simulator opens the app, which appears to be blank.
I already reviewed many posts from people who had the same problem of mine and I tried unsuccessfully their solutions.
The solutions I reviewed are:
- Erase all content of the simulator
- Changed the type of simulator (from iPhone 8 plus to iPhone 7 plus)
- Making sure I had the right settings on the Info.plist
- Build different times the program from scratch as a new one.
And probably others I don't even remember.
I attach my files, as well as the page that opens right when my Simulator launches the application. ( the last screenshot )
Here is the error log
2018-06-18 22:52:29.685489+0200 Bullseye[2247:47563] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Bullseye.ViewController 0x7fc0df70bf90> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key numValue.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010625e1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000102665031 objc_exception_throw + 48
2 CoreFoundation 0x000000010625e0b9 -[NSException raise] + 9
3 Foundation 0x0000000102086b47 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x000000010309cec0 -[UIViewController setValue:forKey:] + 87
5 UIKit 0x000000010338ae8a -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000106200e8d -[NSArray makeObjectsPerformSelector:] + 317
7 UIKit 0x0000000103389834 -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x00000001030a40d7 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
9 UIKit 0x00000001030a4a04 -[UIViewController loadView] + 177
10 UIKit 0x00000001030a4d21 -[UIViewController loadViewIfRequired] + 175
11 UIKit 0x00000001030a5574 -[UIViewController view] + 27
12 UIKit 0x0000000102f73123 -[UIWindow addRootViewControllerViewIfPossible] + 122
13 UIKit 0x0000000102f73834 -[UIWindow _setHidden:forced:] + 294
14 UIKit 0x0000000102f865cc -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x0000000102efa3da -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4739
16 UIKit 0x0000000102eff5cb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677
17 UIKit 0x00000001032c1f7e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
18 UIKit 0x0000000103694a39 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
19 UIKit 0x00000001032c1bba -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
20 UIKit 0x00000001032c23db -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
21 UIKit 0x0000000103c33614 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
22 UIKit 0x0000000103c334ae -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
23 UIKit 0x000000010391775d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
24 UIKit 0x0000000103b124b7 _performActionsWithDelayForTransitionContext + 100
25 UIKit 0x0000000103917627 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
26 UIKit 0x00000001036940e0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
27 UIKit 0x0000000102efdeac -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
28 UIKit 0x00000001034d0bcb -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
29 FrontBoardServices 0x000000010828d2f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
30 FrontBoardServices 0x0000000108295cfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
31 libdispatch.dylib 0x00000001073c27ec _dispatch_client_callout + 8
32 libdispatch.dylib 0x00000001073c7db8 _dispatch_block_invoke_direct + 592
33 FrontBoardServices 0x00000001082c1470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
34 FrontBoardServices 0x00000001082c112e -[FBSSerialQueue _performNext] + 439
35 FrontBoardServices 0x00000001082c168e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
36 CoreFoundation 0x0000000106200bb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
37 CoreFoundation 0x00000001061e54af __CFRunLoopDoSources0 + 271
38 CoreFoundation 0x00000001061e4a6f __CFRunLoopRun + 1263
39 CoreFoundation 0x00000001061e430b CFRunLoopRunSpecific + 635
40 GraphicsServices 0x0000000108b56a73 GSEventRunModal + 62
41 UIKit 0x0000000102f01057 UIApplicationMain + 159
42 Bullseye 0x0000000101d5bad7 main + 55
43 libdyld.dylib 0x000000010743f955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This might be because you have a bad connection in your outlets. Review them. If you have them changed in the view controller, you still need to update them in the storyboard.
the simulator is blank because your app is crashing. Check your storyboard outlet connections to make ensure they are all connected. Open the connections inspector and look out for any broken connections. If your connections are right the circles in your view controller should be filled (see image below)
Related
Outlets Crash at Entry Crash Image Screenshot
I am getting an crash after I renamed my View Controller . Swift file to CalculatorViewController.swift
I also tried refactoring new class name to be mirrored across all ports of entry to the app. I am getting Abort Signal Error. Please do help with this one! This is my error
UPDATE: ERROR IN queue com.apple.mainthread (serial) Thread 1
Crash point in code
class AppDelegate: UIResponder, UIApplicationDelegate {
UPDATE.
2019-03-11 15:36:01.990755+0530 NDv2[4619:144763] Unknown class
CalculatorViewController in Interface Builder file. 2019-03-11
15:36:02.040903+0530 NDv2[4619:144763] * Terminating app due to
uncaught exception 'NSUnknownKeyException', reason:
'[ setValue:forUndefinedKey:]: this
class is not key value coding-compliant for the key TextOutput.'
* First throw call stack: ( 0 CoreFoundation 0x000000010ef3e1bb exceptionPreprocess + 331 1 libobjc.A.dylib
0x000000010cf58735 objc_exception_throw + 48 2 CoreFoundation
0x000000010ef3dd29 -[NSException raise] + 9 3 Foundation
0x000000010c983de4 -[NSObject(NSKeyValueCoding) setValue:forKey:] +
292 4 UIKitCore 0x00000001113a3292
-[UIViewController setValue:forKey:] + 87 5 UIKitCore 0x000000011163a573 -[UIRuntimeOutletConnection connect] + 109 6
CoreFoundation 0x000000010ef29cfd -[NSArray
makeObjectsPerformSelector:] + 317 7 UIKitCore
0x00000001116372b9 -[UINib instantiateWithOwner:options:] + 1814 8
UIKitCore 0x00000001113aa452
-[UIViewController _loadViewFromNibNamed:bundle:] + 383 9 UIKitCore 0x00000001113aaddc -[UIViewController loadView] + 177 10 UIKitCore
0x00000001113ab0ee -[UIViewController loadViewIfRequired] + 175 11
UIKitCore 0x00000001113ab940
-[UIViewController view] + 27 12 UIKitCore 0x0000000111a02c53 -[UIWindow addRootViewControllerViewIfPossible] +
122 13 UIKitCore 0x0000000111a0336e
-[UIWindow _setHidden:forced:] + 294 14 UIKitCore 0x0000000111a165c0 -[UIWindow makeKeyAndVisible] + 42 15 UIKitCore
0x00000001119c3833 -[UIApplication
_callInitializationDelegatesForMainScene:transitionContext:] + 4595 16 UIKitCore 0x00000001119c8c2f
-[UIApplication _runWithMainScene:transitionContext:completion:] + 1623 17 UIKitCore 0x00000001111e74e9
__111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke
+ 866 18 UIKitCore 0x00000001111f029c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 19 UIKitCore 0x00000001111e7126
-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233 20 UIKitCore 0x00000001111e7ae0
-[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085 21 UIKitCore
0x00000001111e5cb5 __82-[_UIApplicationCanvas
_transitionLifecycleStateWithTransitionContext:completion:]_block_invoke
+ 795 22 UIKitCore 0x00000001111e595f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435 23 UIKitCore 0x00000001111eaa90
__125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke
+ 584 24 UIKitCore 0x00000001111eb80e _performActionsWithDelayForTransitionContext + 100 25 UIKitCore 0x00000001111ea7ef -[_UICanvasLifecycleSettingsDiffAction
performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]
+ 221 26 UIKitCore 0x00000001111ef93a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 27 UIKitCore 0x00000001119c744e
-[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515 28
UIKitCore 0x000000011156bd09
-[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357 29
FrontBoardServices 0x000000011a0fc2da -[FBSSceneImpl
_didCreateWithTransitionContext:completion:] + 448 30 FrontBoardServices 0x000000011a107443
__56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271 31
FrontBoardServices 0x000000011a106b3a
__40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53 32 libdispatch.dylib 0x000000011047e602
_dispatch_client_callout + 8 33 libdispatch.dylib 0x0000000110481b78 _dispatch_block_invoke_direct + 301 34
FrontBoardServices 0x000000011a13bba8
__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30 35 FrontBoardServices 0x000000011a13b860
-[FBSSerialQueue _performNext] + 457 36 FrontBoardServices 0x000000011a13be40 -[FBSSerialQueue _performNextFromRunLoopSource] +
45 37 CoreFoundation 0x000000010eea3721
CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 38 CoreFoundation 0x000000010eea2f93
__CFRunLoopDoSources0 + 243 39 CoreFoundation 0x000000010ee9d63f __CFRunLoopRun + 1263 40 CoreFoundation
0x000000010ee9ce11 CFRunLoopRunSpecific + 625 41 GraphicsServices
0x000000011713b1dd GSEventRunModal + 62 42 UIKitCore
0x00000001119ca81d UIApplicationMain + 140 43 NDv2
0x000000010c6291c7 main + 71 44 libdyld.dylib
0x00000001104f4575 start + 1 ) libc++abi.dylib: terminating with
uncaught exception of type NSException
There is two ways to change the name of ViewController:
1)
Ex.: class LoginViewController: UIViewController - just select the "LoginViewController", then right click -> Refactor -> Rename
This will change the name file name, class name and take care of the storyboard class name.
2) If you not able to use Method 1, then manually rename the file Name(.swift), then you have to go to the storyboard and replace the class name of the view controller. You may have issues with the outlets.
3) After that close the Xcode and then again start your project.
You have a textField or textView Or UILabel in your controller in storyboard,
1- Open your Storyboard
2- click the UIViewController(ViewController with new name of class you have changed)
3- remove outlet with name TextOutput
4- ReConnet if you want and you are ready to go
The error you are getting is because you had an IBOutlet on your storyboard that doesn't exist any more on the class where it was defined, this can be because you manually changed the name of a property on your class or deleted it.
On your storyboard, select the initial view controller and check if there is a reference to an IBOutlet named TextOutput. Delete that reference and link the View again. That should fix it
I solved it by setting the 'module' for 'Custom class' in Identity inspector
This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 5 years ago.
I'm currently working myself through this tutorial:
https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/ConnectTheUIToCode.html#//apple_ref/doc/uid/TP40015214-CH22-SW1
After creating the function for the button(at ~2/3 on the page) I tried running the code and got the Exception:
2017-12-08 11:24:31.343183+0100 FoodTracker[2159:154603] ***
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FoodTracker.ViewController 0x7fea6f406820> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key setDefaultLabelText.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109d7512b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001060fcf41 objc_exception_throw + 48
2 CoreFoundation 0x0000000109d75079 -[NSException raise] + 9
3 Foundation 0x0000000105b1ba63 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x0000000106b39117 -[UIViewController setValue:forKey:] + 87
5 UIKit 0x0000000106e2ac2d -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000109d183cd -[NSArray makeObjectsPerformSelector:] + 317
7 UIKit 0x0000000106e295e3 -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x0000000106b403ff -[UIViewController _loadViewFromNibNamed:bundle:] + 383
9 UIKit 0x0000000106b40d2b -[UIViewController loadView] + 177
10 UIKit 0x0000000106b4105c -[UIViewController loadViewIfRequired] + 195
11 UIKit 0x0000000106b418b9 -[UIViewController view] + 27
12 UIKit 0x0000000106a0c7cf -[UIWindow addRootViewControllerViewIfPossible] + 122
13 UIKit 0x0000000106a0ced7 -[UIWindow _setHidden:forced:] + 294
14 UIKit 0x0000000106a1fe54 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x00000001069928b8 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4737
16 UIKit 0x0000000106997aeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
17 UIKit 0x0000000106d616f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
18 UIKit 0x00000001071374c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
19 UIKit 0x0000000106d612f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
20 UIKit 0x0000000106d61b6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
21 UIKit 0x00000001076dfa69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
22 UIKit 0x00000001076df922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
23 UIKit 0x00000001073bc9c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
24 UIKit 0x00000001075bbb06 _performActionsWithDelayForTransitionContext + 100
25 UIKit 0x00000001073bc88b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
26 UIKit 0x0000000107136b25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
27 UIKit 0x000000010699636a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
28 UIKit 0x0000000106f71605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
29 FrontBoardServices 0x000000010bc38cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
30 FrontBoardServices 0x000000010bc417b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
31 libdispatch.dylib 0x000000010ae9733d _dispatch_client_callout + 8
32 libdispatch.dylib 0x000000010ae9c9f3 _dispatch_block_invoke_direct + 592
33 FrontBoardServices 0x000000010bc6d498 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
34 FrontBoardServices 0x000000010bc6d14e -[FBSSerialQueue _performNext] + 464
35 FrontBoardServices 0x000000010bc6d6bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
36 CoreFoundation 0x0000000109d18101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
37 CoreFoundation 0x0000000109db7f71 __CFRunLoopDoSource0 + 81
38 CoreFoundation 0x0000000109cfca19 __CFRunLoopDoSources0 + 185
39 CoreFoundation 0x0000000109cfbfff __CFRunLoopRun + 1279
40 CoreFoundation 0x0000000109cfb889 CFRunLoopRunSpecific + 409
41 GraphicsServices 0x000000010c5019c6 GSEventRunModal + 62
42 UIKit 0x00000001069995d6 UIApplicationMain + 159
43 FoodTracker 0x00000001057e7b67 main + 55
44 libdyld.dylib 0x000000010af13d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Here is my Code:
And the connections inspector of the button:
This is due to FoodTracker VC in storyboard has an outlet created but not connected.
How to resolve the issue? Follow these steps.
Open your storyboard, click on view controller below view controller scene.
Check for all outlets for ViewController.
Remove those outlets created and are not connected to ViewController.swift implementation file.
Keep me updated on the same.
Check your connection to #IBAction with this steps below:
In the storyboard:
In your view controller:
Updated:
In your case, you should remove connection in Reference Outlets because you connect it to the label outlet.
This question already has answers here:
Xcode Console saying Firebase is not configured
(4 answers)
Closed 5 years ago.
I don't know why this isn't working my Firebase is configured.
Here is a Screenshot of my AppDelegate.swift file. Here is my console log:
2017-05-29 17:52:53.141 Study M8[31592] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization. Read more: https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app.
2017-05-29 17:52:53.184 Study M8[31592:1051241] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The default FIRApp instance must be configured before the default FIRAuthinstance can be initialized. One way to ensure that is to call `[FIRApp configure];` is called in `application:didFinishLaunchingWithOptions:`.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a445b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000109eaa141 objc_exception_throw + 48
2 CoreFoundation 0x000000010a4ae625 +[NSException raise:format:] + 197
3 Study M8 0x0000000108550a84 +[FIRAuth auth] + 88
4 Study M8 0x00000001084e7a77 _TFC8Study_M810MessagesVCcfT5coderCSo7NSCoder_GSqS0__ + 279
5 Study M8 0x00000001084e7bcd _TToFC8Study_M810MessagesVCcfT5coderCSo7NSCoder_GSqS0__ + 45
6 UIKit 0x000000010ac70f54 -[UIClassSwapper initWithCoder:] + 246
7 UIKit 0x000000010ae614af UINibDecoderDecodeObjectForValue + 693
8 UIKit 0x000000010ae6164d UINibDecoderDecodeObjectForValue + 1107
9 UIKit 0x000000010ae611ef -[UINibDecoder decodeObjectForKey:] + 89
10 UIKit 0x000000010aa07267 -[UIViewController initWithCoder:] + 1421
11 UIKit 0x000000010aa5cee5 -[UITabBarController initWithCoder:] + 65
12 UIKit 0x000000010ae614af UINibDecoderDecodeObjectForValue + 693
13 UIKit 0x000000010ae611ef -[UINibDecoder decodeObjectForKey:] + 89
14 UIKit 0x000000010ac70c20 -[UIRuntimeConnection initWithCoder:] + 178
15 UIKit 0x000000010ae614af UINibDecoderDecodeObjectForValue + 693
16 UIKit 0x000000010ae6164d UINibDecoderDecodeObjectForValue + 1107
17 UIKit 0x000000010ae611ef -[UINibDecoder decodeObjectForKey:] + 89
18 UIKit 0x000000010ac6fe1d -[UINib instantiateWithOwner:options:] + 1262
19 UIKit 0x000000010b02882f -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
20 UIKit 0x000000010a8688d1 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 108
21 UIKit 0x000000010a868db3 -[UIApplication _loadMainInterfaceFile] + 260
22 UIKit 0x000000010a867456 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1407
23 UIKit 0x000000010a864793 -[UIApplication workspaceDidEndTransaction:] + 182
24 FrontBoardServices 0x000000010d3205f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
25 FrontBoardServices 0x000000010d32046d -[FBSSerialQueue _performNext] + 186
26 FrontBoardServices 0x000000010d3207f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
27 CoreFoundation 0x000000010a3ebc01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
28 CoreFoundation 0x000000010a3d10cf __CFRunLoopDoSources0 + 527
29 CoreFoundation 0x000000010a3d05ff __CFRunLoopRun + 911
30 CoreFoundation 0x000000010a3d0016 CFRunLoopRunSpecific + 406
31 UIKit 0x000000010a86302f -[UIApplication _run] + 468
32 UIKit 0x000000010a8690d4 UIApplicationMain + 159
33 Study M8 0x00000001084e8997 main + 55
34 libdyld.dylib 0x000000010ca5665d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have tried all afternoon to get this working. Please help.
Looking in your stack trace, I get the impression you might be accessing the Firebase.Auth class too soon — maybe in the initWithCoder of your VC? Or as a VC property initial value? — which could be before your AppDelegate runs (and initializes Firebase).
As such, try moving your Auth.auth() call to the viewDidLoad method instead to see if it makes a difference at all.
This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 5 years ago.
I am currently making an app and I am using Swft 3 with Xcode 8.2 beta. I am trying to make it so that the user is able to access the social media from the SWRevealViewController in my iOS project. When the social media buttons are clicked they should open up the corresponding app. However, when the code is executed and the iOS simulator is opened, when I slide to open up the SWRevealViewController(the menu), the app crashes.
Full Error message:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<TheGunnOracleApp.SocialMedia 0x7ffd0d50c0d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key dataSource.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010212dd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000101b8f21e objc_exception_throw + 48
2 CoreFoundation 0x000000010212dc99 -[NSException raise] + 9
3 Foundation 0x000000010169db3f -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x0000000102e8e99f -[UIViewController setValue:forKey:] + 88
5 UIKit 0x0000000103102c6e -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x00000001020d2b60 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x00000001031015f2 -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x0000000102e950d1 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9 UIKit 0x0000000102e959f3 -[UIViewController loadView] + 177
10 UIKit 0x000000010311561c -[UITableViewController loadView] + 84
11 UIKit 0x0000000102e95d28 -[UIViewController loadViewIfRequired] + 201
12 UIKit 0x0000000102e9657c -[UIViewController view] + 27
13 TheGunnOracleApp 0x00000001014d50fb -[SWRevealViewController _deployForViewController:inView:] + 235
14 TheGunnOracleApp 0x00000001014d4f58 -[SWRevealViewController _deploymentForViewController:inView:appear:disappear:] + 136
15 TheGunnOracleApp 0x00000001014d48c1 -[SWRevealViewController _rearViewDeploymentForNewFrontViewPosition:] + 433
16 TheGunnOracleApp 0x00000001014d32f2 -[SWRevealViewController _setFrontViewPosition:withDuration:] + 82
17 TheGunnOracleApp 0x00000001014d26c6 __65-[SWRevealViewController _dispatchSetFrontViewPosition:animated:]_block_invoke + 70
18 TheGunnOracleApp 0x00000001014d1300 -[SWRevealViewController _enqueueBlock:] + 160
19 TheGunnOracleApp 0x00000001014d261b -[SWRevealViewController _dispatchSetFrontViewPosition:animated:] + 251
20 TheGunnOracleApp 0x00000001014d0154 -[SWRevealViewController setFrontViewPosition:animated:] + 148
21 TheGunnOracleApp 0x00000001014cffed -[SWRevealViewController revealToggleAnimated:] + 93
22 TheGunnOracleApp 0x00000001014d05df -[SWRevealViewController revealToggle:] + 63
23 UIKit 0x0000000102cf645c -[UIApplication sendAction:to:from:forEvent:] + 83
24 UIKit 0x0000000103137971 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 149
25 UIKit 0x0000000102cf645c -[UIApplication sendAction:to:from:forEvent:] + 83
26 UIKit 0x0000000102e7c344 -[UIControl sendAction:to:forEvent:] + 67
27 UIKit 0x0000000102e7c65d -[UIControl _sendActionsForEvents:withEvent:] + 444
28 UIKit 0x0000000102e7c7e7 -[UIControl _sendActionsForEvents:withEvent:] + 838
29 UIKit 0x0000000102e7b559 -[UIControl touchesEnded:withEvent:] + 668
30 UIKit 0x0000000102d63d5d -[UIWindow _sendTouchesForEvent:] + 2747
31 UIKit 0x0000000102d6544b -[UIWindow sendEvent:] + 4011
32 UIKit 0x0000000102d1254b -[UIApplication sendEvent:] + 371
33 UIKit 0x00000001034fda0f __dispatchPreprocessedEventFromEventQueue + 3248
34 UIKit 0x00000001034f6745 __handleEventQueue + 4879
35 CoreFoundation 0x00000001020d28e1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
36 CoreFoundation 0x00000001020b7b0c __CFRunLoopDoSources0 + 556
37 CoreFoundation 0x00000001020b6ff6 __CFRunLoopRun + 918
38 CoreFoundation 0x00000001020b6a04 CFRunLoopRunSpecific + 420
39 GraphicsServices 0x0000000107e37a6f GSEventRunModal + 161
40 UIKit 0x0000000102cf4808 UIApplicationMain + 159
41 TheGunnOracleApp 0x00000001014f2d0f main + 111
42 libdyld.dylib 0x0000000105ddd68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Here is the code for each button in the social media.
Note: I removed code for the rest of the social media because of Facebook not working at first:
import Foundation
import UIKit
class SocialMedia: UITableViewController{
#IBAction func facebookOpen(_ sender: Any) {
UIApplication.shared.open(NSURL(string: "https://www.facebook.com/gunnoracle")! as URL)
}
}
Here is a screenshot of what my Main.storyboard UITableViewController looks like:
Seems that the problem is not caused by that very line of code as I just tried it and it worked.
when I slide to open up the SWRevealViewController(the menu), the app crashes.
This is might be the cause. Something wrong with how you use SWRevealViewController.
Maybe somebody can help, I'm trying to move my app to facilitate a new target for the Apple TV.
I create the new Storyboard and linked everything the same way as it has been in the iOS application. When I'm trying to start the application I get the following exception, after the AppDelegate is executed (before it goes into the viewDidLoad of the initial controller.
Any ideas?
2015-09-19 12:24:44.629 App TV[46733:3797033] *** Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CATransformLayer: 0x7fc1e0d51fc0> is a part of cycle in its layer tree'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e850105 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010f271deb objc_exception_throw + 48
2 CoreFoundation 0x000000010e85003d +[NSException raise:format:] + 205
3 QuartzCore 0x0000000111d2f74a _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 102
4 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
5 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
6 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
7 QuartzCore 0x0000000111d37439 _ZN2CA5Layer15insert_sublayerEPNS_11TransactionEP7CALayerm + 389
8 QuartzCore 0x0000000111d3782a -[CALayer addSublayer:] + 193
9 UIKit 0x000000010d2ce424 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1512
10 UIKit 0x000000010d5b1b56 -[UIButton initWithCoder:] + 1424
11 UIKit 0x000000010d79dd62 UINibDecoderDecodeObjectForValue + 705
12 UIKit 0x000000010d79da98 -[UINibDecoder decodeObjectForKey:] + 278
13 UIKit 0x000000010d5d1315 -[UIRuntimeConnection initWithCoder:] + 134
14 UIKit 0x000000010d5d1a77 -[UIRuntimeEventConnection initWithCoder:] + 60
15 UIKit 0x000000010d79dd62 UINibDecoderDecodeObjectForValue + 705
16 UIKit 0x000000010d79df23 UINibDecoderDecodeObjectForValue + 1154
17 UIKit 0x000000010d79da98 -[UINibDecoder decodeObjectForKey:] + 278
18 UIKit 0x000000010d5d0555 -[UINib instantiateWithOwner:options:] + 1255
19 UIKit 0x000000010d3ad7f2 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
20 UIKit 0x000000010d3ae11e -[UIViewController loadView] + 178
21 UIKit 0x000000010d3ae47d -[UIViewController loadViewIfRequired] + 139
22 UIKit 0x000000010d3aec7e -[UIViewController view] + 27
23 UIKit 0x000000010d289484 -[UIWindow addRootViewControllerViewIfPossible] + 61
24 UIKit 0x000000010d289b81 -[UIWindow _setHidden:forced:] + 302
25 UIKit 0x000000010d29b558 -[UIWindow makeKeyAndVisible] + 43
26 UIKit 0x000000010d216063 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
27 UIKit 0x000000010d21c5a8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
28 UIKit 0x000000010d219783 -[UIApplication workspaceDidEndTransaction:] + 188
29 FrontBoardServices 0x000000011097b7ac -[FBSSerialQueue _performNext] + 192
30 FrontBoardServices 0x000000011097bb1a -[FBSSerialQueue _performNextFromRunLoopSource] + 45
31 CoreFoundation 0x000000010e77c1b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x000000010e7720dc __CFRunLoopDoSources0 + 556
33 CoreFoundation 0x000000010e771593 __CFRunLoopRun + 867
34 CoreFoundation 0x000000010e770fa8 CFRunLoopRunSpecific + 488
35 UIKit 0x000000010d2190d5 -[UIApplication _run] + 402
36 UIKit 0x000000010d21de09 UIApplicationMain + 171
37 App TV 0x000000010d0b8fdd main + 109
38 libdyld.dylib 0x00000001149699e9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Funny thing happening, apparently the new Apple TV (4th Gen / tvOS v9.0) can't handle 'Word Wrap' on a button, after setting it to 'Truncate Middle' it starts up fine. Maybe an issue in the beta.
On Xcode 7.2 I had this same error caused by setting the Line Break on a button to 'Character Wrap'. Changing to 'Truncate Middle' stopped the crash.
You can be notified where the exception occurs by activating Exception Breakpoints, then you will be able to see what happens.
You can do so by going on the Breakpoint navigator on Xcode, then on the Plus button at the bottom left.