Interface builder problem: When hooking up an IBOutlet, getting "this class is not key value coding-
- by Robert
Here is what I do:
1) Create New UIViewController subclass , tick with NIB for interface builder
2) In the header:
@interface QuizMainViewController : UIViewController
{
UILabel* aLabel;
}
@property (nonatomic, retain) IBOutlet UILabel* aLabel;
@end
3) In the .m
#import "QuizMainViewController.h"
@implementation QuizMainViewController
@synthesize aLabel;
- (void)dealloc
{
[aLabel release];
[super dealloc];
}
@end
4) Open the NIB In interface builder, drag a new UILabel into the view.
I test the program here and it runs fine.
5) right click on file's owner, connect 'aLabel' from the Outlets to the UILabel.
I run here and it crashes. Message from log:
* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aLabel.'