title: Change View Controllers After Facebook Login
body: <p><img src="https://i.stack.imgur.com/1fq5n.png" alt="enter image description here">
  I have my view controller listed below that handles the Facebook Login. As it is now, the app runs and loads a view that has the Facebook login button. Once logged in, the button changes the text to "Log out". What I would like to happen is once a user is logged in, it then goes to another view controller.</p>
  
  <p>I have added a new view controller in storyboard and did a "segue" between the two, but I feel like I am missing something. The new view controller I made is named "homeViewController" if that helps. Thanks</p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
      self.loginView.readPermissions = @[@"public_profile", @"email", @"user_friends"];
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id&lt;FBGraphUser&gt;)user
  {
      NSLog(@"%@", user.name);
  }
  
  - (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView
  {
      NSLog(@"You are logged in! :) ");
  }
  
  - (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView
  {
      NSLog(@"You are logged out! :( ");
  }
  
  - (void)loginView:(FBLoginView *)loginView handleError:(NSError *)error
  {
      NSString *alertMessage, *alertTitle;
  
      if ([FBErrorUtility shouldNotifyUserForError:error])
      {
          alertTitle = @"Facebook error";
          alertMessage = [FBErrorUtility userMessageForError:error];
  
      }
      else if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryAuthenticationReopenSession)
      {
          alertTitle = @"Session Error";
          alertMessage = @"Your current session is no longer valid. Please log in again.";
  
      }
      else if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryUserCancelled)
      {
          NSLog(@"user cancelled login");
  
      }
      else
      {
          alertTitle  = @"Something went wrong";
          alertMessage = @"Please try again later.";
          NSLog(@"Unexpected error:%@", error);
      }
  
      if (alertMessage)
      {
          [[[UIAlertView alloc] initWithTitle:alertTitle
                                      message:alertMessage
                                     delegate:nil
                            cancelButtonTitle:@"OK"
                            otherButtonTitles:nil] show];
      }
  }
  
  @end
  </code></pre>