QViet
QViet

Reputation: 327

Uncaught Error on Storyboard Trigger Segue

I'm using Storyboards and when I trigger segue, I get some error: Uncaught Exception:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason:      '[<CommercerApp.ProductDetailController 0x78ff1030> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key contentView.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00c9f946 _exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x00928a97 objc_exception_throw + 44
    2   CoreFoundation                      0x00c9f561 -[NSException raise] + 17
    3   Foundation                          0x005b010e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x0050c138 _NSSetUsingKeyValueSetter + 115
    5   Foundation                          0x0050c0bd -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   Foundation                          0x005419a6 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 386
    7   UIKit                               0x01639649 -[UIRuntimeOutletConnection connect] + 106
    8   libobjc.A.dylib                     0x0093e724 -[NSObject performSelector:] + 62
    9   CoreFoundation                      0x00bd95dc -[NSArray makeObjectsPerformSelector:] + 316
    10  UIKit                               0x0163810a -[UINib instantiateWithOwner:options:] + 1775
    11  UIKit                               0x0145a624 -[UIViewController _loadViewFromNibNamed:bundle:] + 270
    12  UIKit                               0x0145adbb -[UIViewController loadView] + 295
    13  UIKit                               0x0145afef -[UIViewController loadViewIfRequired] + 78
    14  UIKit                               0x0145b595 -[UIViewController view] + 35
    15  UIKit                               0x0149c534 -[UINavigationController preferredContentSize] + 161
    16  UIKit                               0x0143644d -[UIPresentationController preferredContentSizeDidChangeForChildContentContainer:] + 122
    17  UIKit                               0x01433922 _56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 156
    18  UIKit                               0x014677ab _40+[UIViewController _scheduleTransition:]_block_invoke + 18
    19  UIKit                               0x0132d0ce __afterCACommitHandler_block_invoke + 15
    20  UIKit                               0x0132d079 _applyBlockToCFArrayCopiedToStack + 415
    21  UIKit                               0x0132ce8e _afterCACommitHandler + 545
    22  CoreFoundation                      0x00bc29de _CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    23  CoreFoundation                      0x00bc2920 _CFRunLoopDoObservers + 400
    24  CoreFoundation                      0x00bb835a _CFRunLoopRun + 1226
    25  CoreFoundation                      0x00bb7bcb CFRunLoopRunSpecific + 443
    26  CoreFoundation                      0x00bb79fb CFRunLoopRunInMode + 123
    27  GraphicsServices                    0x0526024f GSEventRunModal + 192
    28  GraphicsServices                    0x0526008c GSEventRun + 104
    29  UIKit                               0x013038b6 UIApplicationMain + 1526
    30  CommercerApp                        0x0012dbce top_level_code + 78
    31  CommercerApp                        0x0012dc0b main + 43
    32  libdyld.dylib                       0x02b24ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

My storyboard is like this:(I get Exception when I open 4th-->5th segue from left to right) Storyboard

If you have any idea, please help me to solve it.

Upvotes: 0

Views: 361

Answers (1)

Neeku
Neeku

Reputation: 3653

The error does explain the problem, you just need to read it carefully:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason:      '[<CommercerApp.ProductDetailController 0x78ff1030> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key contentView.'

and let me highlight it for you:

reason: '[<CommercerApp.ProductDetailController 0x78ff1030> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key contentView.'

And that means that a class is trying to set a property on an object through key-value coding, and failing at that. This might happen if you define an IBOutlet and hook it up in Storyboards; then later delete the outlet in the code and cause the Storyboards having a dangling connection. In this case the buggy piece seems to be in ProductDetailController, and you should go back there and check what you've changed without updating your Storyboards accordingly.

Upvotes: 1

Related Questions