title: xcode 6: TwitterKit not keeping session open after Authentication
body: <p>I'm calling up a session in my LoginViewController as seen below. The problem is that, after it authenticates and closes the popupview... the session returns nil.  So it initially reaches out to the api and starts a session (the first log records nil as the session is open and the second log records "Signed in as..." with the username) then when it closes the login view it records nil again.  Not exactly use what I could be doing wrong... </p>
  
  <p>Could it be because I'm using TWTRSession* session to check the session? Could that be logging me off? Or is it related to me closing the popupview?</p>
  
  <p>I do essentially the same thing with my facebook login but the facebook session stays open until I logout...</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      self.email.delegate = self;
      self.pass.delegate = self;
      //self.view.frame = CGRectMake(self.bounds.size.width, self.bounds.size.height);
      [Fabric with:@[[Twitter sharedInstance]]];
  
      TWTRSession* session;
      if (session) {
          NSLog(@"Early bird %@", [session userName]);
          [self closePopup];
      }
      else {
          NSLog(@"No dice");
      }
      /*
      TWTRLogInButton *logInButton = [TWTRLogInButton buttonWithLogInCompletion:^(TWTRSession *session, NSError *error) {
          // play with Twitter session
      }];
      logInButton.center = self.view.center;
      [self.view addSubview:logInButton];
  */
      TWTRLogInButton* logInButton =  [TWTRLogInButton
                                       buttonWithLogInCompletion:
                                       ^(TWTRSession* session, NSError* error) {
                                           if (session) {
                                               NSLog(@"signed in as %@", [session userName]);
                                               [self closePopup];
                                           } else {
                                               NSLog(@"error: %@", [error localizedDescription]);
                                           }
                                       }];
  </code></pre>
  
  <p>I decided to include my actionsheet as well so you could see how I'm handling the login/logout situation:</p>
  
  <pre><code>- (void)sheet: (id) sender {
      NSString *email = [[NSUserDefaults standardUserDefaults] objectForKey:@"email"];
      UIActionSheet *sheet;
      TWTRSession *session;
      //if ([FBSDKAccessToken currentAccessToken]) {
      if (email == nil &amp;&amp; [FBSDKAccessToken currentAccessToken] == nil &amp;&amp; session == nil) {
          sheet = [[UIActionSheet alloc] initWithTitle:@"Profile"
                                                             delegate:nil // Can be another value but will be overridden when showing with handler.
                                                    cancelButtonTitle:@"Cancel"
                                               destructiveButtonTitle:@"Login"
                                                    otherButtonTitles:nil];
      }
      else
      {
          sheet = [[UIActionSheet alloc] initWithTitle:@"Profile"
                                                         delegate:nil // Can be another value but will be overridden when showing with handler.
                                                cancelButtonTitle:@"Cancel"
                                           destructiveButtonTitle:@"Logout"
                                                otherButtonTitles:@"User page", nil];
      }
          [sheet showInView:self.view
                handler:^(UIActionSheet *actionSheet, NSInteger buttonIndex) {
  
                    if (buttonIndex == [actionSheet cancelButtonIndex]) {
                        NSLog(@"Cancel button index tapped");
                    } else if (buttonIndex == [actionSheet destructiveButtonIndex]) {
                        if (email == nil &amp;&amp; [FBSDKAccessToken currentAccessToken] == nil &amp;&amp; session == nil) {
                            LoginViewController *loginView = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:[NSBundle mainBundle]];
                            //[self.view modalViewController:loginView animated:YES];
                            //[self presentModalViewController:loginView animated:YES];
                            //[self.navigationController pushViewController:loginView animated:YES];
                            loginView.delegate = (id) self;
                            [self presentPopupViewController:loginView animationType:MJPopupViewAnimationSlideTopBottom];
                            NSLog(@"Login View");
                        }
                        else
                        {
                            [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"email"];
                            FBSDKLoginManager *logout = [[FBSDKLoginManager alloc] init];
                            [logout logOut];
                        }
                    } else  {
  
                        NSLog(@"Button %i tapped", buttonIndex);
                        if (buttonIndex == 1) {
                            UserViewController * userView = [[UserViewController alloc] initWithNibName:@"UserView" bundle:[NSBundle mainBundle]];
                            [userView setUEmail:email];
                            [self presentViewController:userView animated:YES completion:nil];
                        }
                    }                      
                }];
  
  }
  </code></pre>