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 an Interactive Story App with Swift 2 Refactoring the Model Layer Handling Incorrect Input

Paul M
Paul M
16,370 Points

I got THREAD 1 SIGABIRT when running my app, does anyone have the same problem?

I got this error THREAD 1 SIGABIRT in my code with a big console error, did anyone have the same problem and if so, can you help me?

Project: https://github.com/pauldesign/InteractiveStory

Console Message

2016-08-09 14:01:23.779 InteractiveStory[11660:854654] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<InteractiveStory.ViewController 0x7fcd71d7b9f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key nameTestField.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010e765d85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000110509deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010e7659c9 -[NSException raise] + 9
    3   Foundation                          0x000000010eb3719b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
    4   UIKit                               0x000000010f120d0c -[UIViewController setValue:forKey:] + 88
    5   UIKit                               0x000000010f3577fb -[UIRuntimeOutletConnection connect] + 109
    6   CoreFoundation                      0x000000010e69f890 -[NSArray makeObjectsPerformSelector:] + 224
    7   UIKit                               0x000000010f3561de -[UINib instantiateWithOwner:options:] + 1864
    8   UIKit                               0x000000010f1278d6 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
    9   UIKit                               0x000000010f128202 -[UIViewController loadView] + 178
    10  UIKit                               0x000000010f128560 -[UIViewController loadViewIfRequired] + 138
    11  UIKit                               0x000000010f16cfae -[UINavigationController _layoutViewController:] + 54
    12  UIKit                               0x000000010f16d882 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 462
    13  UIKit                               0x000000010f16d9f4 -[UINavigationController _startTransition:fromViewController:toViewController:] + 126
    14  UIKit                               0x000000010f16ec4d -[UINavigationController _startDeferredTransitionIfNeeded:] + 890
    15  UIKit                               0x000000010f16fd0b -[UINavigationController __viewWillLayoutSubviews] + 57
    16  UIKit                               0x000000010f31e503 -[UILayoutContainerView layoutSubviews] + 248
    17  UIKit                               0x000000010f048980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
    18  QuartzCore                          0x0000000113a13c00 -[CALayer layoutSublayers] + 146
    19  QuartzCore                          0x0000000113a0808e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
    20  QuartzCore                          0x0000000113a07f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    21  QuartzCore                          0x00000001139fc3c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
    22  QuartzCore                          0x0000000113a2a086 _ZN2CA11Transaction6commitEv + 486
    23  QuartzCore                          0x0000000113a2a7f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    24  CoreFoundation                      0x000000010e68ac37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    25  CoreFoundation                      0x000000010e68aba7 __CFRunLoopDoObservers + 391
    26  CoreFoundation                      0x000000010e68011c CFRunLoopRunSpecific + 524
    27  UIKit                               0x000000010ef88f21 -[UIApplication _run] + 402
    28  UIKit                               0x000000010ef8df09 UIApplicationMain + 171
    29  InteractiveStory                    0x000000010e575d32 main + 114
    30  libdyld.dylib                       0x0000000110fcd92d start + 1
    31  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I tried your project and it works fine. could you please indicate which screen in the interactive story gives you this error?

Paul M
Paul M
16,370 Points

It's in the app delegate

1 Answer

Hi Paul,

Have you added a connection between code & UI a couple of times and one might not have worked properly? This error can sometimes be caused by having disconnected code/UI elements that you can fix inside your storyboard.

Steve.

Paul M
Paul M
16,370 Points

Thanks! I just realized that I changed the name in the code outlet. But not the one on the storyboard!