Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift Improving Our User Interface Random Colors

Jose Wences
Jose Wences
4,596 Points

Build a Simple iphone app with swift 3. Video Random Colors. Run time error.

As it runs nothing shows up and Xcode takes me to AppDelgate.Swift but we never even modify that file in the video. Not sure what happen? And the stuff below is in the debug section.

2016-12-28 16:03:07.503381 FunFacts[8852:1044649] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-12-28 16:03:07.615915 FunFacts[8852:1044649] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-12-28 16:03:08.164810 FunFacts[8852:1044642] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-12-28 16:03:08.480874 FunFacts[8852:1044240] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-12-28 16:03:09.736 FunFacts[8852:1044240] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FunFacts.ViewController 0x7f9ed240c180> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key funfactButton.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000108bd834b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000105db621e objc_exception_throw + 48
    2   CoreFoundation                      0x0000000108bd8299 -[NSException raise] + 9
    3   Foundation                          0x00000001058c62ff -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
    4   UIKit                               0x00000001064eb8c3 -[UIViewController setValue:forKey:] + 88
    5   UIKit                               0x000000010675fbe6 -[UIRuntimeOutletConnection connect] + 109
    6   CoreFoundation                      0x0000000108b7d590 -[NSArray makeObjectsPerformSelector:] + 256
    7   UIKit                               0x000000010675e56a -[UINib instantiateWithOwner:options:] + 1867
    8   UIKit                               0x00000001064f1ff5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
    9   UIKit                               0x00000001064f2917 -[UIViewController loadView] + 177
    10  UIKit                               0x00000001064f2c4c -[UIViewController loadViewIfRequired] + 201
    11  UIKit                               0x00000001064f34a0 -[UIViewController view] + 27
    12  UIKit                               0x00000001063bd045 -[UIWindow addRootViewControllerViewIfPossible] + 71
    13  UIKit                               0x00000001063bd796 -[UIWindow _setHidden:forced:] + 293
    14  UIKit                               0x00000001063d10a9 -[UIWindow makeKeyAndVisible] + 42
    15  UIKit                               0x000000010634a259 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818
    16  UIKit                               0x00000001063503b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
    17  UIKit                               0x000000010634d539 -[UIApplication workspaceDidEndTransaction:] + 188
    18  FrontBoardServices                  0x000000010fc9e76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    19  FrontBoardServices                  0x000000010fc9e5e4 -[FBSSerialQueue _performNext] + 189
    20  FrontBoardServices                  0x000000010fc9e96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    21  CoreFoundation                      0x0000000108b7d311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    22  CoreFoundation                      0x0000000108b6259c __CFRunLoopDoSources0 + 556
    23  CoreFoundation                      0x0000000108b61a86 __CFRunLoopRun + 918
    24  CoreFoundation                      0x0000000108b61494 CFRunLoopRunSpecific + 420
    25  UIKit                               0x000000010634bdb6 -[UIApplication _run] + 434
    26  UIKit                               0x0000000106351f34 UIApplicationMain + 159
    27  FunFacts                            0x00000001057d562f main + 111
    28  libdyld.dylib                       0x0000000109b0268d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Jose Wences
Jose Wences
4,596 Points

Fixed the problem.

Stephen Emery
Stephen Emery
14,384 Points

For those who encounter this as well, this error is stating there is an unused or unhandled connection between the funFactButton and the ViewController.

To fix it, right click the element (Show another fact button in this case). Look for the connections. Click x next to any connections not used. Then try to rebuild the project.