Error in Facebook API Return

1

Here's my scenario for better understanding:

  • I have View Home calling View View, by pushViewController .
  • In my View Login, there is the custom Facebook button that is normally calling the facebook authorization page;
  • But the return of the facebook permission screen is causing me problems, instead of returning to my View Login, is returning to my View Home;

I'm getting the following message in the log: Unbalanced calls to begin/end appearance transitions for <XXX.LoginTableViewController: 0x14eba93d0> .

This is my action for login, it will not stay this way, but I've been simplifying the most to try to find the problem:

@IBAction func facebookButton() {
    let login = FBSDKLoginManager()
    login.logInWithReadPermissions(["public_profile", "email"],
                                   fromViewController: self) { (result, error) in

        if error != nil {
            print("deu merda")
        } else if result.isCancelled {
            print("cancelou")
        } else {
            print("login")
        }
    }
}

Note: In the same View Login I have the Twitter login button, which is working normally.

    
asked by anonymous 29.06.2016 / 07:33

1 answer

1
  

Unbalanced calls to begin / end appearance transitions for   "LoginTableViewController"

This error happens because at some point in your code you are doing pushViewController more than once at the same time.

For example: You create a button in the Storyboard and connect a segue to that button to another screen, and also create a IBAction clickBotao: method that calls the other screen as well. In that case you will have 2 pushs on the same screen and this causes this error.

Make sure that when it returns from Facebook callback it is not doing something like I explained above.

    
29.06.2016 / 19:37