TWTRLogInButton not showing OAuth flow

I am making an iOS app using swift that needs to connect to twitter and I am using TwitterKit with Fabric to do this.

I did it as shown here: https://dev.twitter.com/twitter-kit/ios/twitter-login

But, when twitter account is not defined in my iOS settings, TWTRLogInButton does not stream OAuth for login. Or it should: "The SDK tries to use Twitter accounts first through accounts. If that fails, it falls back to the OAuth flow view."

I may have forgotten to do something, but this is not explained in the tutorial and I haven't found any other answer.

My code: (Twitter.sharedInstance (). LogInWithCompletion is called when the view is loaded, so it might not be here what it should be, but I don't know where to put it)

override func viewDidLoad() {
    super.viewDidLoad()

    logInButton = TWTRLogInButton(logInCompletion:
        { (session, error) in
            if (session != nil) {
                println("signed in as \(session.userName)");
            } else {
                println("error: \(error.localizedDescription)");

            }
            self.refreshInterfaceBasedOnTwitterSignIn()
    })

    Twitter.sharedInstance().logInWithCompletion {
        (session, error) -> Void in
        if (session != nil) {
            println("signed in as \(session.userName)");
        } else {
            println("error: \(error.localizedDescription)");
        }
    }

      

Thank!

+3


source to share


1 answer


To use the OAuth flow on your Twitter app account, you need to set the callback field.



+1


source







All Articles