Elad Benda
Elad Benda

Reputation: 36654

ailed to set (keyPath) user defined inspected property on this class is not key value coding-compliant for the key keyPath

my swift app is failing while runtime. How can I fix this?

I have checked and avgTime_text is well defined.

I don't know how to read the stacktrace in xcode, can someone help with a little guidance ?

2016-02-06 15:16:07.298 Inline[39053:200479] Unknown class _TtC6Inline24InlineMainViewController in Interface Builder file.
2016-02-06 15:16:15.414 Inline[39053:] <GMR/INFO> App measurement v.1302000 started
2016-02-06 15:16:15.414 Inline[39053:] <GMR/INFO> To enable debug logging set the following application argument: -GMRDebugEnabled (see http://goo.gl/Y0Yjwu)
2016-02-06 15:16:15.466 Inline[39053:200479] Unknown class _TtC6Inline24InlineMainViewController in Interface Builder file.
2016-02-06 15:16:15.524 Inline[39053:200479] Unknown class logo in Interface Builder file.
2016-02-06 15:16:15.538 Inline[39053:200479] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7fa3590a47d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-06 15:16:15.538 Inline[39053:200479] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7fa3590c9c70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-06 15:16:15.538 Inline[39053:200479] Failed to set (keyPath) user defined inspected property on (UIView): [<UIView 0x7fa35846ccf0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2016-02-06 15:16:15.542 Inline[39053:200479] WARNING: GoogleAnalytics 3.14 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:48): Uncaught exception: [<UIViewController 0x7fa3590c4cd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key avgTime_text.
2016-02-06 15:16:15.672 Inline[39053:] <GMR/INFO> App measurement enabled
2016-02-06 15:16:20.548 Inline[39053:200479] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fa3590c4cd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key avgTime_text.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010ab10e65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010bfd3deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010ab10aa9 -[NSException raise] + 9
    3   Foundation                          0x000000010bba09bb -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
    4   UIKit                               0x000000010cb15320 -[UIViewController setValue:forKey:] + 88
    5   UIKit                               0x000000010cd43f41 -[UIRuntimeOutletConnection connect] + 109
    6   CoreFoundation                      0x000000010aa514a0 -[NSArray makeObjectsPerformSelector:] + 224
    7   UIKit                               0x000000010cd42924 -[UINib instantiateWithOwner:options:] + 1864
    8   UIKit                               0x000000010cb1beea -[UIViewController _loadViewFromNibNamed:bundle:] + 381
    9   UIKit                               0x000000010cb1c816 -[UIViewController loadView] + 178
    10  UIKit                               0x000000010cb1cb74 -[UIViewController loadViewIfRequired] + 138
    11  UIKit                               0x000000010cb1d2e7 -[UIViewController view] + 27
    12  UIKit                               0x000000010c9f3ab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
    13  UIKit                               0x000000010c9f4199 -[UIWindow _setHidden:forced:] + 282
    14  UIKit                               0x000000010ca05c2e -[UIWindow makeKeyAndVisible] + 42
    15  Inline                              0x00000001097984f7 _TFC6Inline11AppDelegate16launchStoryboardfS0_FOS_10StoryboardT_ + 1127
    16  Inline                              0x0000000109798048 _TFC6Inline11AppDelegate25chooseAndLuanchStoryboardfS0_FT_T_ + 248
    17  Inline                              0x00000001097985a9 _TFC6Inline11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 105
    18  Inline                              0x00000001097986e3 _TToFC6Inline11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 179
    19  UIKit                               0x000000010c97d1f1 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
    20  UIKit                               0x000000010c97e397 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
    21  UIKit                               0x000000010c984cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
    22  UIKit                               0x000000010c981e7b -[UIApplication workspaceDidEndTransaction:] + 188
    23  FrontBoardServices                  0x000000011019d754 -[FBSSerialQueue _performNext] + 192
    24  FrontBoardServices                  0x000000011019dac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    25  CoreFoundation                      0x000000010aa3ca31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    26  CoreFoundation                      0x000000010aa3295c __CFRunLoopDoSources0 + 556
    27  CoreFoundation                      0x000000010aa31e13 __CFRunLoopRun + 867
    28  CoreFoundation                      0x000000010aa31828 CFRunLoopRunSpecific + 488
    29  UIKit                               0x000000010c9817cd -[UIApplication _run] + 402
    30  UIKit                               0x000000010c986610 UIApplicationMain + 171
    31  Inline                              0x00000001097998dd main + 109
    32  libdyld.dylib                       0x000000010e5b792d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

here is where the code fails: window?.makeKeyAndVisible() under AppDeligate

func launchStoryboard(storyboard: Storyboard) {
    window = UIWindow(frame: UIScreen.mainScreen().bounds)
    UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .Slide)
    let storyboard = UIStoryboard(name: storyboard.rawValue, bundle: nil)
    let controller = storyboard.instantiateInitialViewController()!
    if (controller is InlineMainViewController ){
        mainViewController = controller as! InlineMainViewController
    }
    window?.rootViewController = controller
    window?.makeKeyAndVisible()
}

Upvotes: 2

Views: 3491

Answers (1)

Daniel
Daniel

Reputation: 21

Even though this is an old post, check in Xcode for user defined runtime attributes. You've probably got a default attribute declared there, removing it should resolve your problem.

Upvotes: 2

Related Questions