I am writing an iPhone application that contains a tab controller, each tab item has a separated view controller and a xib file.
It work normal when I only display views without any outlet connections from nib to my class. But when I try to connect items on the xib to my class variable. The application always crash.
The code is like:
@interface TabX : UIViewController {
IBOutlet UILabel *label;
}
@property (nonatomic, retain) UILabel *label;
@end
@implementation PromotionNews
@synthesize label;
...
@end
The crash occurs when I make connection in IB to connect a Label object to my file owener's label outlet. The file owner is set to class TabX type.
Part of the trace is :
2010-09-30 10:23:59.503 MyNearByInfoApp[2613:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6d28530> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key label.'
*** Call stack at first throw:
(
0 CoreFoundation 0x02664b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x027b440e objc_exception_throw + 47
2 CoreFoundation 0x02664ad1 -[NSException raise] + 17
3 Foundation 0x000330f3 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x00033061 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004b170a -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x025dad0f -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004b0121 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004b1eb5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
Any idea what this crash happen?