title: Programmatically calling segue not working
body: <p>I am trying to open a special viewController if it is the users first time on my App. I've gotten this to work before in other situations but for some reason it isn't working now. I've tried two different approaches and neither one is working. The first thing I tried is checking and doing it straight from the appDelegate...then I tried checking if it was the first time from the root view controllers viewDidLoad method and if it is the first time calling the seque to open a special registration page. Niether is working and I have no idea why.....Here is some of the code I'm using:</p>
  
  <p>This is inside the rootviewcontroller. When I do it it prints out "Main is First Time" on the log so I know it is making it there. I double checked the segue in the storyboard and it is named correctly and goes to and from the right places.... </p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
      if([appDelegate firstTime])
      {
      [self performSegueWithIdentifier:@"mToRegister" sender:self];
          NSLog(@"Main is First time");
      }
      // Do any additional setup after loading the view.
  }
  </code></pre>
  
  <p>Inside the appDelegate:</p>
  
  <p>NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];<br>
      BOOL haveused = [standardUserDefaults boolForKey:@"haveused"];</p>
  
  <pre><code>if(haveused){       
      //NOT THEIR FIRST TIME
      //Handle scenario
      firstTime = NO;
  
      NSString* guid = [[NSMutableString alloc]initWithString:[self getMacAddress]];
      //interest = [appDelegate interest];
  
      NSString *splitter = [[NSString alloc]initWithString:@"&amp;"];
      NSMutableString *post = [[NSMutableString alloc]initWithString: @"user_read=1&amp;guid="];
      [post appendString:guid];
      NSLog(@"String for Post is %@", post);
      NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
      NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
      NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
      [request setValue:@"Basic ==" forHTTPHeaderField:@"Authorization"];
      [request setURL:[NSURL URLWithString:@"http://something.com/app/usercrud.php"]];
      [request setHTTPMethod:@"POST"];
      [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
      [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
      [request setHTTPBody:postData];
  
      theConnection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
  }
  else {
          NSLog(@"This is the First time");
          firstTime = YES;
          //THEIR FIRST TIME
          //Handle scenario
  
  
  
  //        UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
  //                                                                 bundle: nil];
  //        
  //        UIViewController *controller = (UIViewController*)[mainStoryboard 
  //                                                           instantiateViewControllerWithIdentifier: @"register"];
  //        UIViewController *root = (UIViewController *)self.window.rootViewController;
  //        [root presentModalViewController:controller animated:YES]; 
          [self.window.rootViewController performSegueWithIdentifier:@"mToRegister" sender:self];        
  
      }
  </code></pre>
  
  <p>Any ideas why it wouldn't be working? If not anybody know a better way to handle this situation?</p>