Terminating app due to uncaught exception 'NSUnknownKeyException'

Discussion in 'iOS Programming' started by cmi2012, Jul 10, 2012.

  1. cmi2012 macrumors newbie

    Joined:
    Jul 10, 2012
    #1
    I have a brand new MacBook Pro with a new download and install of xcode 4.3.3. When I start a new "Single View" iPad project and immediately try to run it with no modifications (iPad 5.1 Simulator), I get the following in the Target Output and this line in the main.m file is highlighted

    Code:
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    I am new to xcode but not programming. Since there are no modifications to the initial code, I assume there is something wrong with the installation or configuration of xcode? Any help would be appreciated!


    Code:
    *2012-07-10 08:25:34.569 cmi3[355:f803] *** Terminating app due to uncaught
    exception 'NSUnknownKeyException', reason: '[<UIApplication 0x6868730>
    setValue:forUndefinedKey:]: this class is not key value coding-compliant
    for the key view.'*
    
    **** First throw call stack:*
    
    *(0x13c7022 0x1558cd6 0x13c6ee1 0x9bf022 0x930f6b 0x930edb 0x94bd50
    0x23371a 0x13c8dea 0x13327f1 0x23226e 0x233eb7 0x10ce1 0x10ff8 0x1017f
    0x1f183 0x1fc38 0x13634 0x12b1ef5 0x139b195 0x12ffff2 0x12fe8da 0x12fdd84
    0x12fdc9b 0xfc65 0x11626 0x1d5d 0x1cc5)*
    
    *terminate called throwing an exception**(lldb) *
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Apparently there is a property in a XIB that is calling "view", so right click in the xibs on the window or VIew don't know what you have, look if something has the property "view", if it is like I think, it should have a yellow '!' next to it, to show you that it hasn't been found :)

    Good luck.
     
  3. cmi2012 thread starter macrumors newbie

    Joined:
    Jul 10, 2012
    #3
    I guess I am confused! This is an Out-Of-The-Box new project with no modification what so ever. How would there be a code error? I am new to Xcode so please bear with me! I only have one .xib file: ViewController.xib and when I click on it, I get the Interface Builder with no visible code. I have attached all code files for this project.
     

    Attached Files:

  4. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #4
    I found what was wrong.
    In your 'iPad deployment info" the XIB was there at "Main Interface", I think you "accidently" filled that in or not? I'm not sure and not blaming you, but changing that should resolve the issue (change it to blank, because AppDelegate will do this for you.)
     
  5. cmi2012 thread starter macrumors newbie

    Joined:
    Jul 10, 2012
    #5
    Now it's time to show what a newbie I am, how do I get to there? I do not remember changing anything and this error is recreated with every new project that I create. Thanks!
     
  6. cmi2012 thread starter macrumors newbie

    Joined:
    Jul 10, 2012
    #6
    Found it! Thanks!
     
  7. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #7
    Great, but does the solution also works? :)
     
  8. Mobile Dog macrumors newbie

    Joined:
    Jul 20, 2012
    #8
    Newb as well

    I had the same error as cmi2012 and followed jnoxx instructions and it works thanks for the input jnoxx! :D
     
  9. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #9

    I'm an experienced iOS developer, and I'm not sure what you are referring to.

    Is the 'iPad deployment info' a setting in the plist? In target build settings? How do you get to it?

    It's puzzling that the OP gets this problem on a brand new, blank project. I tried it (currently running Xcode 4.5, the beta) I don't have this problem.
     
  10. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #10
    Hey Duncan, I know you are an experienced developer, no doubt, hands down.
    What I was referring to was the iPad deployment on your target
    -> screenshot Screenshot
    In older projects (I never had it since a while, so don't know what happened in OP's case), you had a Mainwindows.xib, it was trying to call it, but wasn't there.
    Hope I made it more clear now.

    ----------

    No problem man, glad I could help ^_-
     
  11. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #11
    Thanks for the clarification.

    Indeed, if you select the project in the leftmost column, then select the target, and select the "summary tab", there is an input box "Main interface". If you tap in that, it changes from blank to putting the name of a view controller "ViewController" in that box.

    If you do that, the project then crashes on launch as the OP reported.

    To get rid of the crash, you have to clear out that text, then click in the other input box to get it to save. Then running the project a second time doesn't crash any more.
     

Share This Page