{"id":4250,"date":"2014-03-30T09:25:40","date_gmt":"2014-03-30T09:25:40","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/iboutlets-not-setting-in-nsviewcontroller-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:25:40","modified_gmt":"2014-03-30T09:25:40","slug":"iboutlets-not-setting-in-nsviewcontroller-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/iboutlets-not-setting-in-nsviewcontroller-collection-of-common-programming-errors\/","title":{"rendered":"IBOutlets Not Setting in NSViewController-Collection of common programming errors"},"content":{"rendered":"<p>So I&#8217;ve got an NSViewController (MyVC) set up like so:<\/p>\n<pre><code>\/\/MyVC.h\n...\n@property (nonatomic, retain) IBOutlet NSTextField *input;\n...\n\n\/\/MyVC.m\n...\n@synthesize input;\n\n- (id)init\n{\n    self = [super initWithNibName: @\"MyVC\" bundle: [NSBundle mainBundle]];\n    NSLog(@\"%@\", input); \/\/prints (null) always\n    return self;\n}\n\n- (void)loadView\n{\n    [super loadView];\n    NSLog(@\"%@\", input); \/\/still (null)\n}\n...\n\n\/\/MyVC.xib\n\nCustom View       [Referencing Outlet:    File's Owner.view]\n    Text Field    [Referencing Outlet:    File's Owner.input]\n<\/code><\/pre>\n<p>Now, when I load this NSViewController (by way of <code>MyVC *vc = [[MyVC alloc] init];<\/code>) and load it into a window, I see the Text Field appropriately. However, as the above paste (and several BAD_ACCESSes) would suggest, <code>vc.input<\/code> is never properly pointing to the Text Field.<\/p>\n<p><em>Notes:<\/em><\/p>\n<ul>\n<li>This project is running ARC.<\/li>\n<li>This is not a simplification or generalization. I&#8217;ve run this exact code to no avail.<\/li>\n<li>All IBOutlets are definitely set up appropriately.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>So I&#8217;ve got an NSViewController (MyVC) set up like so: \/\/MyVC.h &#8230; @property (nonatomic, retain) IBOutlet NSTextField *input; &#8230; \/\/MyVC.m &#8230; @synthesize input; &#8211; (id)init { self = [super initWithNibName: @&#8221;MyVC&#8221; bundle: [NSBundle mainBundle]]; NSLog(@&#8221;%@&#8221;, input); \/\/prints (null) always return self; } &#8211; (void)loadView { [super loadView]; NSLog(@&#8221;%@&#8221;, input); \/\/still (null) } &#8230; \/\/MyVC.xib Custom [&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-4250","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4250","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=4250"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4250\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}