{"id":4188,"date":"2014-03-30T09:08:15","date_gmt":"2014-03-30T09:08:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/interface-builder-problem-when-hooking-up-an-iboutlet-getting-this-class-is-not-key-value-coding-compliant-for-the-key-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:08:15","modified_gmt":"2014-03-30T09:08:15","slug":"interface-builder-problem-when-hooking-up-an-iboutlet-getting-this-class-is-not-key-value-coding-compliant-for-the-key-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/interface-builder-problem-when-hooking-up-an-iboutlet-getting-this-class-is-not-key-value-coding-compliant-for-the-key-collection-of-common-programming-errors\/","title":{"rendered":"Interface builder problem: When hooking up an IBOutlet, getting &ldquo;this class is not key value coding-compliant for the key&rdquo;-Collection of common programming errors"},"content":{"rendered":"<p>Here is what I do:<\/p>\n<p>1) Create New UIViewController subclass , tick with NIB for interface builder<\/p>\n<p>2) In the header:<\/p>\n<pre><code>@interface QuizMainViewController : UIViewController \n{\n    UILabel* aLabel;\n} \n\n@property (nonatomic, retain) IBOutlet UILabel* aLabel;\n\n@end\n<\/code><\/pre>\n<p>3) In the .m<\/p>\n<pre><code>#import \"QuizMainViewController.h\"    \n\n@implementation QuizMainViewController\n\n@synthesize aLabel;\n\n- (void)dealloc \n{\n    [aLabel release];\n    [super dealloc];\n}\n\n@end\n<\/code><\/pre>\n<p>4) Open the NIB In interface builder, drag a new UILabel into the view.<\/p>\n<p>I test the program here and it runs fine.<\/p>\n<p>5) right click on file&#8217;s owner, connect &#8216;aLabel&#8217; from the Outlets to the UILabel.<\/p>\n<p>I run here and it crashes. Message from log:<\/p>\n<p><em>*<\/em> Terminating app due to uncaught exception &#8216;NSUnknownKeyException&#8217;, reason: &#8216;[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aLabel.&#8217;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;QuizMainViewController.h&#8221; @implementation QuizMainViewController @synthesize aLabel; &#8211; (void)dealloc { [aLabel release]; [super dealloc]; } @end [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4188","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4188"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4188\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}