Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

this class is not key value coding-compliant for the key XXXXXX

when i try to build and run my app, it crashes and i got this in the log :

reason: '[<LoadingViewController 0x6b2c5a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aproposViewController.'

the strange is that aproposViewController is not used in LoadingViewController, it's just another view controller in my app. please help, thx in advance :)

EDIT

appdelegate.h :

@class LoadingViewController;

@interface TopStationAppDelegate : NSObject <UIApplicationDelegate,CLLocationManagerDelegate> {
    UIWindow *window;
    LoadingViewController *loadingView;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet LoadingViewController *loadingView;
@end

appdelegate.m :

#import "LoadingViewController.h"
@implementation TopStationAppDelegate
@synthesize window;
@synthesize loadingView;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  [window addSubview:loadingView.view];
    [window makeKeyAndVisible];
    return YES;
}
- (void)dealloc {
    [loadingView release];
    [window release];
    [super dealloc];
}
@end

there is no declaration of aproposViwController, even in IB for the main view !! EDIT 2 here two screenshot of my besic set in the main and loadingView in interface builder : enter image description here

enter image description here

like image 374
Luca Avatar asked May 08 '11 21:05

Luca


Video Answer


4 Answers

Can't be sure if this is what's happening in your case, but you'll commonly see this message if you have a connection set up in your nibs to assign an object to a property of another object, but the property is missing on the target object.

So you might have had an IBOutlet named aproposViewController on LoadingViewController at one point, connected another view controller to it in the nib, and then removed the IBOutlet but neglected to remove the connection in the nib.

So when the nib is loaded, it tries to set the property, only to find it doesn't exist, hence:

reason: '[<LoadingViewController 0x6b2c5a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aproposViewController.'
like image 153
kball Avatar answered Nov 09 '22 23:11

kball


I had this problem and it was because I had an:

vc = [[someVC alloc] initWithNibName:@"oldNibFileNameButCachedSomewhereWithOldRefToPropertyIn" bundle:nil];
like image 28
Eagerbvr Avatar answered Nov 10 '22 00:11

Eagerbvr


If you removed the connection to IBOutlet from XIB and still it happens

Then delete the app from simulator and run again.

like image 20
Navnath Godse Avatar answered Nov 10 '22 00:11

Navnath Godse


I have found the same error in my Application and I found solution for this after some time.

Actually I Have given 2 action events for one button. I have removed extra connection which is assigned to button after that the problem is over.

This is worked in my scenario. I hope it will be helpful to someone else..

like image 21
Narasimha Nallamsetty Avatar answered Nov 09 '22 22:11

Narasimha Nallamsetty