Error in Facebook API Return

Asked

Viewed 105 times

1

Follow my scenario for better understanding:

  • I have View Home calling View Login, by pushViewController.
  • In my Login View, 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 it returning to my Login View, is returning to my Home View;

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

This is my login action, it won’t stay this way, but I was 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 Login View I have the login button of Twitter, which is working normally.

  • The app is using lib Enswiftsidemenu and saw all Alertview is using the dispatch_async(dispatch_get_main_queue()). If you take them they give the same error of the facebook view.

1 answer

1


Unbalanced calls to Begin/end Appearance Transitions for "Logintableviewcontroller"

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

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

Make sure when he returns from Facebook callback he’s not doing something like I explained above.

  • Can I see the navigational hierarchy to identify this? My navigation to Logintableviewcontroller is done by push as it is called by several different views.

  • You can see the hierarchy by Storyboard if you are using it, or if not, you can put a breakpoint in every place that makes a push from Logintableviewcontroller to see how your hierarchy is.

  • I did not find anything of the type in my code, but the app is using the lib Enswiftsidemenu. And I saw that I can’t put my facebook login in any view other than the ones in the lib menu.

  • It was that same my problem, as I am only giving maintenance in the code I went to review all the code ready and I found that during the assembly of the menu of Snswiftsidemenu the former developer made a gambiarras that ran two pushs!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.