title: presentViewController in viewDidLoad
body: <p>I'm trying to use presentViewController from viewDidLoad using this code:</p>
  
  <pre><code>@implementation ViewController
  
  - (void)showLogin{
      id animator = [[MyCustomAnimator alloc] init];
      NSViewController* vc = [[MyViewController alloc] initWithNibName:nil bundle:nil];
  
      [self presentViewController:vc animator:animator];
  }
  
  - (void)viewDidLoad {
      [super viewDidLoad];
      self.title = @"Presenting ViewController";
      [self showLogin];
  }
  
  @end
  </code></pre>
  
  <p>It works fine when I call it from a IBAction button but doing it programatically I'm getting this error:</p>
  
  <pre><code> *** Assertion failure in -[ViewController presentViewController:animator:], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1404.12/Controllers/NSViewController.m:826
  
  Failed to set (contentViewController) user defined inspected property on (NSWindow): presentViewController:animator:: View '&lt;ViewController: 0x6000000c28b0&gt;''s view is not in a window/view hierarchy.
  </code></pre>
  
  <p>Not sure how to proceed, could anyone point me in the right direction?</p>