HELP! *** Terminating app due to uncaught exception 'NSUnknownKeyException'

Discussion in 'iOS Programming' started by rwaller1, Sep 3, 2013.

  1. rwaller1 macrumors newbie

    Joined:
    Sep 3, 2013
    #1
    Ok guys,

    I need some help, I am using Xcode 5.0 and developing for iOS 7.0. I am getting this error and it won't open my app in the Simulator.

    AssertMacros: queueEntry, file: /SourceCache/IOKitUser_Sim/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512
    2013-09-03 22:15:25.999 Gamer Trivia[645:a0b] Flurry: Starting session on Agent Version [Flurry_iOS_118_4.2.3]
    2013-09-03 22:15:29.266 Gamer Trivia[645:a0b] [TJLog level: 4] Tapjoy Request: https://connect.tapjoy.com/connect?...1.0.3&device_location=true&device_name=x86_64
    2013-09-03 22:15:29.716 Gamer Trivia[645:a0b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MainMenuViewController 0xe1a3230> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btnRestore.'
    *** First throw call stack:
    (
    0 CoreFoundation 0x058d16f4 __exceptionPreprocess + 180
    1 libobjc.A.dylib 0x030f88b6 objc_exception_throw + 44
    2 CoreFoundation 0x05961721 -[NSException raise] + 17
    3 Foundation 0x0284ce7e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4 Foundation 0x027b918b _NSSetUsingKeyValueSetter + 88
    5 Foundation 0x027b86e3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6 Foundation 0x0281ab9a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
    7 UIKit 0x01ba3265 -[UIRuntimeOutletConnection connect] + 106
    8 libobjc.A.dylib 0x0310a7d2 -[NSObject performSelector:] + 62
    9 CoreFoundation 0x058ccc7a -[NSArray makeObjectsPerformSelector:] + 314
    10 UIKit 0x01ba1dbe -[UINib instantiateWithOwner:eek:ptions:] + 1417
    11 UIKit 0x01a14f05 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
    12 UIKit 0x01a156ad -[UIViewController loadView] + 302
    13 UIKit 0x01a159ae -[UIViewController loadViewIfRequired] + 78
    14 UIKit 0x01a15eb4 -[UIViewController view] + 35
    15 UIKit 0x0193f6fd -[UIWindow addRootViewControllerViewIfPossible] + 66
    16 UIKit 0x0193fa97 -[UIWindow _setHidden:forced:] + 312
    17 UIKit 0x0193fd2d -[UIWindow _orderFrontWithoutMakingKey] + 49
    18 UIKit 0x0194a562 -[UIWindow makeKeyAndVisible] + 65
    19 Gamer Trivia 0x00008877 -[RTAppDelegate application:didFinishLaunchingWithOptions:] + 1095
    20 UIKit 0x018fd525 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
    21 UIKit 0x018fdd65 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
    22 UIKit 0x01902578 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
    23 UIKit 0x0191657c -[UIApplication handleEvent:withNewEvent:] + 3447
    24 UIKit 0x01916ae9 -[UIApplication sendEvent:] + 85
    25 UIKit 0x019041f5 _UIApplicationHandleEvent + 736
    26 GraphicsServices 0x05ca033b _PurpleEventCallback + 776
    27 GraphicsServices 0x05c9fe46 PurpleEventCallback + 46
    28 CoreFoundation 0x0584ce95 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    29 CoreFoundation 0x0584cbcb __CFRunLoopDoSource1 + 523
    30 CoreFoundation 0x058778ac __CFRunLoopRun + 2156
    31 CoreFoundation 0x05876bf3 CFRunLoopRunSpecific + 467
    32 CoreFoundation 0x05876a0b CFRunLoopRunInMode + 123
    33 UIKit 0x01901cad -[UIApplication _run] + 840
    34 UIKit 0x01903f0b UIApplicationMain + 1225
    35 Gamer Trivia 0x000083fd main + 141
    36 libdyld.dylib 0x067cd725 start + 0
    37 ??? 0x00000001 0x0 + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
     
  2. Scott90 macrumors 6502

    Joined:
    Jul 14, 2008
    #2
    Looks like you used to have a button in your storyboard called btnRestore, and connected this to an outlet. Then you deleted the button, but the connection was still there. Look at the connections for that view controller, and delete any that you don't need anymore, or that don't exist anymore.
     
  3. rwaller1 thread starter macrumors newbie

    Joined:
    Sep 3, 2013
    #3
    Ok

    I will see if I can find it! Thanks so much!
     
  4. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #4
    Note that these broken connections are defined in IB (Interface Builder). Go through your XIB files or storyboards. Select the view controller (or "File's owner" as it's called in XIB files) and choose the connections inspector. Look for IBOutlet links that use the name listed in your error message.

    If you have an IBOutlet linked in IB, be aware that if you delete the outlet in code, or rename it, it leaves a broken link that causes this error at runtime.

    The "refactor" command in XCode can rename outlets and rename the IBOutlet Link in IB all in one step. Get in the habit of using Refactor to rename outlets and actions.
     
  5. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #5
    Cool - it didn't occur to me that refactor would deal with this.
     

Share This Page