title: How can I load a view controller in viewDidLoad?
body: <p>I have the following code in viewDidLoad. I want to compare a nsdate I have saved in nsuserdefaults restrictionTime.  </p>
  
  <pre><code>if ([[NSDate date]timeIntervalSinceDate:[restrictionTime objectForKey:@"time"]] &lt; 86400) {
  
      ResultsViewController *destinationViewController = [[ResultsViewController alloc]init];
      UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
      destinationViewController = [storyboard instantiateViewControllerWithIdentifier:@"results"];
  
      [self presentViewController:destinationViewController animated:NO completion:^{
      }]; // !!!!! this line 
  
  }
  </code></pre>
  
  <p><strong><em>When it gets to the line specified in the code, the app runs viewDidLoad recursively.</em></strong> All I want to do is compare the time now and the time I saved in NSUserDefaults. If it is less than a day, then it will present another viewController. </p>
  
  <p>*if I comment out the line specified above, it runs fine. </p>
  
  <pre><code>NSLog(@"%f", [[NSDate date]timeIntervalSinceDate:[restrictionTime objectForKey:@"time"]]);
  </code></pre>
  
  <p>The above NSLog returns 2167.23445. </p>