user1352207
user1352207

Reputation: 1

NSUnknownKeyException when loading xib

I'm having a problem using the TOSplitViewController(http://blog.trustedones.com/development/ipad-uisplitviewcontroller-replacement-for-sethidesmasterviewinportrait) for IOS6 because my app is crashing immediately after the load screen, the error is this:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:'[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navRoot.'`


First throw call stack:
(0x1964012 0x1294e7e 0x19ecfb1 0x28a711 0x20bec8 0x20b9b7 0x236428 0x7d70cc 0x12a8663 0x195f45a 0x7d5bcf 0x69ae37 0x69b418 0x7e934e 0x69b648 0x69b882 0x69bb2a 0x6b2ef5 0x6b2fdb 0x6b3286 0x6b3381 0x6b3eab 0x6b3fc9 0x6b4055 0x7b93ab 0x60a92d 0x12a86b0 0x2dfbfc0 0x2df033c 0x2dfbeaf 0x6a98cd 0x5f21a6 0x5f0cbf 0x5f0bd9 0x5efe34 0x5efc6e 0x5f0a29 0x5f3922 0x69dfec 0x5eabc4 0x5eb311 0x2423 0x5b77b7 0x5b7da7 0x5b8fab 0x5ca315 0x5cb24b 0x5bccf8 0x18bfdf9 0x18bfad0 0x18d9bf5 0x18d9962 0x190abb6 0x1909f44 0x1909e1b 0x5b87da 0x5ba65c 0x20ed 0x2025)
libc++abi.dylib: terminate called throwing an exception

My appdelegate

@class RootViewController;
@class DetailViewController;

@interface SplitViewAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    TOSplitViewController *splitViewController;

    RootViewController *rootViewController;
    DetailViewController *detailViewController;

    IBOutlet UINavigationController *navRoot;
    IBOutlet UINavigationController *navDetail;
}

@property (nonatomic, retain) UINavigationController *navRoot;
@property (nonatomic, retain) UINavigationController *navDetail;

@property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet TOSplitViewController *splitViewController;
@property (nonatomic, retain) IBOutlet RootViewController *rootViewController;
@property (nonatomic, retain) IBOutlet DetailViewController *detailViewController;

@end

navRoot is connected to RootView and this is a UINavigationController

the problem is that I really need to make this work for IOS4-6 and everything was working perfect until now. Can someone help with this? thanks

Upvotes: 0

Views: 595

Answers (2)

Marc Charbonneau
Marc Charbonneau

Reputation: 40515

The reason you're seeing this exception is when the .xib is loaded it's trying to set the navRoot property on some object which doesn't actually implement that property. Usually this happens when you change the class of an object while editing the .xib, but forget to check its connections. Take a look inside the .xib and see if you can find any objects with invalid connections.

Upvotes: 0

Phillip Mills
Phillip Mills

Reputation: 31016

Check your xib or storyboard file that contains the RootViewController. The odds are that you have something connected visually to an outlet called navRoot which doesn't actually exist in your code.

Upvotes: 1

Related Questions