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

iOS - Self Destruct Messaging App

First I get this error before the app will even compile. So when I go to replace this line of code

self.videoFilePath = [[info objectForKey:UIImagePickerControllerMediaURL] path]; 

with either this:

self.videoFilePath = (__bridge NSString *)([[info objectForKey:UIImagePickerControllerMediaURL] path]);

or this:

self.videoFilePath = CFBridgingRelease([[info objectForKey:UIImagePickerControllerMediaURL] path]);

I get this error in the log....

2014-02-01 11:21:21.731 Ribbit[27395:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LogInViewController 0xa97e170> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key background.'
*** First throw call stack:
(
    0   CoreFoundation                      0x028d65e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x026598b6 objc_exception_throw + 44
    2   CoreFoundation                      0x029666a1 -[NSException raise] + 17
    3   Foundation                          0x00cd6c2e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x00c42f3b _NSSetUsingKeyValueSetter + 88
    5   Foundation                          0x00c42493 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   Foundation                          0x00ca494a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
    7   UIKit                               0x01a92cd5 -[UIRuntimeOutletConnection connect] + 106
    8   libobjc.A.dylib                     0x0266b7d2 -[NSObject performSelector:] + 62
    9   CoreFoundation                      0x028d1b6a -[NSArray makeObjectsPerformSelector:] + 314
    10  UIKit                               0x01a9182e -[UINib instantiateWithOwner:options:] + 1417
    11  UIKit                               0x01903c95 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
    12  UIKit                               0x0190443d -[UIViewController loadView] + 302
    13  UIKit                               0x0190473e -[UIViewController loadViewIfRequired] + 78
    14  UIKit                               0x01904c44 -[UIViewController view] + 35
    15  UIKit                               0x0192a844 -[UINavigationController _startTransition:fromViewController:toViewController:] + 223
    16  UIKit                               0x0192b72c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
    17  UIKit                               0x0192c349 -[UINavigationController __viewWillLayoutSubviews] + 57
    18  UIKit                               0x01a6539d -[UILayoutContainerView layoutSubviews] + 213
    19  UIKit                               0x0185bdd7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
    20  libobjc.A.dylib                     0x0266b81f -[NSObject performSelector:withObject:] + 70
    21  QuartzCore                          0x0158672a -[CALayer layoutSublayers] + 148
    22  QuartzCore                          0x0157a514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    23  QuartzCore                          0x01586675 -[CALayer layoutIfNeeded] + 160
    24  UIKit                               0x01916ca3 -[UIViewController window:setupWithInterfaceOrientation:] + 304
    25  UIKit                               0x01835d27 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5212
    26  UIKit                               0x018348c6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
    27  UIKit                               0x01834798 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
    28  UIKit                               0x01834820 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
    29  UIKit                               0x018338ba __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
    30  UIKit                               0x0183381c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
    31  UIKit                               0x01834573 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
    32  UIKit                               0x01837b66 -[UIWindow setDelegate:] + 449
    33  UIKit                               0x01908dc7 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
    34  UIKit                               0x0182d7cc -[UIWindow addRootViewControllerViewIfPossible] + 609
    35  UIKit                               0x0182d947 -[UIWindow _setHidden:forced:] + 312
    36  UIKit                               0x0182dbdd -[UIWindow _orderFrontWithoutMakingKey] + 49
    37  UIKit                               0x0183844a -[UIWindow makeKeyAndVisible] + 65
    38  UIKit                               0x017eb8e0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1851
    39  UIKit                               0x017effb8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
    40  UIKit                               0x0180442c -[UIApplication handleEvent:withNewEvent:] + 3447
    41  UIKit                               0x01804999 -[UIApplication sendEvent:] + 85
    42  UIKit                               0x017f1c35 _UIApplicationHandleEvent + 736
    43  GraphicsServices                    0x039392eb _PurpleEventCallback + 776
    44  GraphicsServices                    0x03938df6 PurpleEventCallback + 46
    45  CoreFoundation                      0x02851dd5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    46  CoreFoundation                      0x02851b0b __CFRunLoopDoSource1 + 523
    47  CoreFoundation                      0x0287c7ec __CFRunLoopRun + 2156
    48  CoreFoundation                      0x0287bb33 CFRunLoopRunSpecific + 467
    49  CoreFoundation                      0x0287b94b CFRunLoopRunInMode + 123
    50  UIKit                               0x017ef6ed -[UIApplication _run] + 840
    51  UIKit                               0x017f194b UIApplicationMain + 1225
    52  Ribbit                              0x0000b5fd main + 141
    53  libdyld.dylib                       0x0313f70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

anybody have any suggestions?

7 Answers

Stone Preston
Stone Preston
42,016 Points

try using the workaround in the teachers notes of this video it also has a forum post you can refer to.

here is the work around, but it might be better to look at it in some context

NSURL *imagePickerURL = [info objectForKey:UIImagePickerControllerMediaURL]; 

self.videoFilePath = [imagePickerURL path];

Hmmm I went back and watched that video about 6 times and never thought to look at the teacher's note... thank you for bringing that to my attention. I checked out the forum post and got the error to go away, however it is still not letting me run the app and throwing the same error into the log as above.

Just an update. I went back and started an new project and just copied all my old code into the new project and everything worked fine.

Stone Preston
Stone Preston
42,016 Points

alright cool. I wonder what was wrong, glad you got it working though

Maybe it's not the same error

2014-02-01 13:15:57.594 Ribbit[27742:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LogInViewController 0xa9ceda0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key background.'
*** First throw call stack:
(
    0   CoreFoundation                      0x028d65e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x026598b6 objc_exception_throw + 44
    2   CoreFoundation                      0x029666a1 -[NSException raise] + 17
    3   Foundation                          0x00cd6c2e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x00c42f3b _NSSetUsingKeyValueSetter + 88
    5   Foundation                          0x00c42493 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   Foundation                          0x00ca494a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
    7   UIKit                               0x01a92cd5 -[UIRuntimeOutletConnection connect] + 106
    8   libobjc.A.dylib                     0x0266b7d2 -[NSObject performSelector:] + 62
    9   CoreFoundation                      0x028d1b6a -[NSArray makeObjectsPerformSelector:] + 314
    10  UIKit                               0x01a9182e -[UINib instantiateWithOwner:options:] + 1417
    11  UIKit                               0x01903c95 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
    12  UIKit                               0x0190443d -[UIViewController loadView] + 302
    13  UIKit                               0x0190473e -[UIViewController loadViewIfRequired] + 78
    14  UIKit                               0x01904c44 -[UIViewController view] + 35
    15  UIKit                               0x0192a844 -[UINavigationController _startTransition:fromViewController:toViewController:] + 223
    16  UIKit                               0x0192b72c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
    17  UIKit                               0x0192c349 -[UINavigationController __viewWillLayoutSubviews] + 57
    18  UIKit                               0x01a6539d -[UILayoutContainerView layoutSubviews] + 213
    19  UIKit                               0x0185bdd7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
    20  libobjc.A.dylib                     0x0266b81f -[NSObject performSelector:withObject:] + 70
    21  QuartzCore                          0x0158672a -[CALayer layoutSublayers] + 148
    22  QuartzCore                          0x0157a514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    23  QuartzCore                          0x01586675 -[CALayer layoutIfNeeded] + 160
    24  UIKit                               0x01916ca3 -[UIViewController window:setupWithInterfaceOrientation:] + 304
    25  UIKit                               0x01835d27 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5212
    26  UIKit                               0x018348c6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
    27  UIKit                               0x01834798 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
    28  UIKit                               0x01834820 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
    29  UIKit                               0x018338ba __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
    30  UIKit                               0x0183381c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
    31  UIKit                               0x01834573 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
    32  UIKit                               0x01837b66 -[UIWindow setDelegate:] + 449
    33  UIKit                               0x01908dc7 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
    34  UIKit                               0x0182d7cc -[UIWindow addRootViewControllerViewIfPossible] + 609
    35  UIKit                               0x0182d947 -[UIWindow _setHidden:forced:] + 312
    36  UIKit                               0x0182dbdd -[UIWindow _orderFrontWithoutMakingKey] + 49
    37  UIKit                               0x0183844a -[UIWindow makeKeyAndVisible] + 65
    38  UIKit                               0x017eb8e0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1851
    39  UIKit                               0x017effb8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
    40  UIKit                               0x0180442c -[UIApplication handleEvent:withNewEvent:] + 3447
    41  UIKit                               0x01804999 -[UIApplication sendEvent:] + 85
    42  UIKit                               0x017f1c35 _UIApplicationHandleEvent + 736
    43  GraphicsServices                    0x039392eb _PurpleEventCallback + 776
    44  GraphicsServices                    0x03938df6 PurpleEventCallback + 46
    45  CoreFoundation                      0x02851dd5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    46  CoreFoundation                      0x02851b0b __CFRunLoopDoSource1 + 523
    47  CoreFoundation                      0x0287c7ec __CFRunLoopRun + 2156
    48  CoreFoundation                      0x0287bb33 CFRunLoopRunSpecific + 467
    49  CoreFoundation                      0x0287b94b CFRunLoopRunInMode + 123
    50  UIKit                               0x017ef6ed -[UIApplication _run] + 840
    51  UIKit                               0x017f194b UIApplicationMain + 1225
    52  Ribbit                              0x0000b5fd main + 141
    53  libdyld.dylib                       0x0313f70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
Stone Preston
Stone Preston
42,016 Points

set an exception breakpoint in your app by going to debug -> breakpoints -> create exception breakpoint. Run the app and it will break at the code that is causing the exception. Post the line of code that is causing the error.

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
Stone Preston
Stone Preston
42,016 Points

whats the name of your app delegate? is it AppDelegate or something like PTAppDelegate?

When I started coding the app it was PT_AppDelegate, but after a few hours I stopped using the prefix and refactored everything that did have the prefix... I'm looking at the AppDelegate and everything seems to be fine there

Stone Preston
Stone Preston
42,016 Points

maybe try putting your prefix back in there.

return UIApplicationMain(argc, argv, nil, NSStringFromClass([PT_AppDelegate class]));

and only getting

(lldb) 

in the log

Stone Preston
Stone Preston
42,016 Points

whats your stack trace look like?

you've lost me...

Thread 1, Queue : com.apple.main-thread
#0  0x0265988a in objc_exception_throw ()
#1  0x029666a1 in -[NSException raise] ()
#2  0x00cd6c2e in -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] ()
#3  0x00c42f3b in _NSSetUsingKeyValueSetter ()
#4  0x00c42493 in -[NSObject(NSKeyValueCoding) setValue:forKey:] ()
#5  0x00ca494a in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#6  0x01a92cd5 in -[UIRuntimeOutletConnection connect] ()
#7  0x0266b7d2 in -[NSObject performSelector:] ()
#8  0x028d1b6a in -[NSArray makeObjectsPerformSelector:] ()
#9  0x01a9182e in -[UINib instantiateWithOwner:options:] ()
#10 0x01903c95 in -[UIViewController _loadViewFromNibNamed:bundle:] ()
#11 0x0190443d in -[UIViewController loadView] ()
#12 0x0190473e in -[UIViewController loadViewIfRequired] ()
#13 0x01904c44 in -[UIViewController view] ()
#14 0x0192a844 in -[UINavigationController _startTransition:fromViewController:toViewController:] ()
#15 0x0192b72c in -[UINavigationController _startDeferredTransitionIfNeeded:] ()
#16 0x0192c349 in -[UINavigationController __viewWillLayoutSubviews] ()
#17 0x01a6539d in -[UILayoutContainerView layoutSubviews] ()
#18 0x0185bdd7 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#19 0x0266b81f in -[NSObject performSelector:withObject:] ()
#20 0x0158672a in -[CALayer layoutSublayers] ()
#21 0x0157a514 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#22 0x01586675 in -[CALayer layoutIfNeeded] ()
#23 0x01916ca3 in -[UIViewController window:setupWithInterfaceOrientation:] ()
#24 0x01835d27 in -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] ()
#25 0x018348c6 in -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] ()
#26 0x01834798 in -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] ()
#27 0x01834820 in -[UIWindow _setRotatableViewOrientation:duration:force:] ()
#28 0x018338ba in __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke ()
#29 0x0183381c in -[UIWindow _updateToInterfaceOrientation:duration:force:] ()
#30 0x01834573 in -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] ()
#31 0x01837b66 in -[UIWindow setDelegate:] ()
#32 0x01908dc7 in -[UIViewController _tryBecomeRootViewControllerInWindow:] ()
#33 0x0182d7cc in -[UIWindow addRootViewControllerViewIfPossible] ()
#34 0x0182d947 in -[UIWindow _setHidden:forced:] ()
#35 0x0182dbdd in -[UIWindow _orderFrontWithoutMakingKey] ()
#36 0x0183844a in -[UIWindow makeKeyAndVisible] ()
#37 0x017eb8e0 in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] ()
#38 0x017effb8 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#39 0x0180442c in -[UIApplication handleEvent:withNewEvent:] ()
#40 0x01804999 in -[UIApplication sendEvent:] ()
#41 0x017f1c35 in _UIApplicationHandleEvent ()
#42 0x039392eb in _PurpleEventCallback ()
#43 0x03938df6 in PurpleEventCallback ()
#44 0x02851dd5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#45 0x02851b0b in __CFRunLoopDoSource1 ()
#46 0x0287c7ec in __CFRunLoopRun ()
#47 0x0287bb33 in CFRunLoopRunSpecific ()
#48 0x0287b94b in CFRunLoopRunInMode ()
#49 0x017ef6ed in -[UIApplication _run] ()
#50 0x017f194b in UIApplicationMain ()
#51 0x0000b5fd in main at /Users/reas0n/Desktop/apps/Ribbit/Ribbit/main.m:16
Thread 2, Queue : com.apple.libdispatch-manager
Thread 3, Queue : PFCommandCache
Thread 4, Queue : (null)
Thread 5, Queue : (null)
Thread 6, Queue : (null)
Thread 7, Queue : (null)
Thread 8 com.apple.NSURLConnectionLoader, Queue : (null)
Thread 9, Queue : (null)
Thread 10, Queue : (null)
Thread 11, Queue : (null)
Thread 12, Queue : com.apple.root.default-priority
Thread 13, Queue : (null)

this?