title: Facebook LoginManager Callback/PrepareforSegue Swift
body: <p>I'm trying to pass a property to my next VC using prepareforSegue. It is called, however my other VC does not load.  </p>
  
  <p>Original</p>
  
  <pre><code>@IBAction func onSignupPressed(sender: AnyObject) {
      FBSDKLoginManager().logInWithReadPermissions(permissions,
      fromViewController: self) { result, error in
      guard error == nil else { print("Login Error"); return }
      guard result.grantedPermissions.contains("email") else {
          print("No Email Permissions"); return }
      self.getFBUserData()
      dispatch_async(dispatch_get_main_queue()) {
          self.performSegueWithIdentifier("loginSegue", sender: self)
          }
      }
  }
  </code></pre>
  
  <p>I've been able to get the next VC showing by doing calling my doLogin function below.  And there I instantiate a VC from the storyboard and present it. I believe it is due to the timing of the Facebook login window that pops up and closes.  I searched for a delegate method, but have not found anything</p>
  
  <pre><code>@IBAction func onSignupPressed(sender: AnyObject) {
      FBSDKLoginManager().logInWithReadPermissions(permissions,
      fromViewController: self) { result, error in
      guard error == nil else { print("Login Error"); return }
      guard result.grantedPermissions.contains("email") else {
          print("No Email Permissions"); return }
      self.getFBUserData()
      dispatch_async(dispatch_get_main_queue()) {
          self.performSegueWithIdentifier("loginSegue", sender: self)
          }
      }
  }
  
  func getFBUserData(){
  
      let params = "id, name, first_name, last_name, picture.type(large),friends, email, birthday, work, photos, education, location, hometown, religion, likes, about"
  
      if((FBSDKAccessToken.currentAccessToken()) != nil){
          FBSDKGraphRequest(graphPath: "me", parameters: ["fields":params]).startWithCompletionHandler({ (connection, result, error) -&gt; Void in
  
              if (error == nil){
                  //everything works print the user data
                  print(result)
                  let resultdict = result as? NSDictionary
                  self.user = Mapper&lt;User&gt;().map(result)
                  self.doLogin()
              }
  
          }) 
  
      }
  
  }
  
  
  func doLogin() {
          let successVC = self.storyboard?.instantiateViewControllerWithIdentifier("LoginSucessViewController")
          self.presentViewController(successVC!, animated: true, completion: nil)
            }
  </code></pre>