[[Twitter sharedInstance] logInWithCompletion runs twice


I am using a custom button to create a twitter login button in my app. the IBAction for that button is:

[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
            if (session) {
                NSLog(@"signed in as %@", [session userName]);
                NSLog(@"userID %@", session.userID);
                NSLog(@"userToken %@", session.authToken);
                NSLog(@"userSecret %@", session.authTokenSecret);
            } else {
                NSLog(@"Error: %@", [error localizedDescription]);

The issue I am facing is that TwitterKit makes all actions twice: If the user has multiple accounts saved in iOS, it shows the action sheet to select account twice (tapping cancel shows the second open action sheet). If the user has no accounts saved in iOS, it opens the UIWebView for log in also twice. Any suggestions?


I replied via email, but if anyone else is running into this:

The button (TWTRLogInButton) will log in all on its own, so having an extra OnClick() action is redundant.

import UIKit
import TwitterKit

class ViewController: UIViewController {

    @IBOutlet weak var twitterButton: TWTRLogInButton!
    override func viewDidLoad() {

        twitterButton.logInCompletion = { (session, error) in



@val Thanks a lot. By just setting the completion handler of the TWTRLoginButton solves the issue.