[Bug][Twitter] - iOS Twitter Login



Hello. I am trying to implement login with Twitter. I followed the setup guide, so i have the consumer key, consumer secret and the url scheme up and ready.
The problem that I have is that the completion block of loginWithCompletion isn’t called. So i can’t present error messages, like “User allowed permission to system accounts but there were none set up.”, to the user. Thanks in advance

[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession * _Nullable session, NSError * _Nullable error) {
        if (error) {
            NSLog(@"twitter error: %@", error.localizedDescription);
        NSMutableDictionary*  parameters = [[NSMutableDictionary alloc] init];
        [parameters setObject:session.authToken
        [parameters setObject:session.authTokenSecret
        [_WSM loginUserWithParameters:parameters
                            andResult:^(WebServiceResponse *response, id responseObject, NSError *error) {


Hey @vladminea94, I created a test app on my end and it seems to be working. I used the following code:

- (IBAction)signIn:(UIButton *)sender {
    [[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
        if (session) {
            NSLog(@"signed in as %@", [session userName]);
        } else {
            NSLog(@"error: %@", [error localizedDescription]);

Does this code work on your end?


Hello @alexsinger. Thanks for your reply.

Yes, it does. But i ran it on the simulator as i don’t have an iOS device with me now.
My code also works on the simulator but it didn’t work when i ran the app on an iPhone 6 with iOS 10.2.1.
Forgot to mention that :smiley:

An error (which says that the user didn’t setup his twitter account in System Accounts) is logged in the debugger console and that’s all…

[TwitterKit] did encounter error with message “Unable to authenticate using the system account.”: Error Domain=TWTRLogInErrorDomain Code=2 “User allowed permission to system accounts but there were none set up.”


@vladminea94 hmmm, if I run the above code on a device that doesn’t have a Twitter system account set up, I’m taken to web view where I have the option to login. Can you share the steps you’re taking to get that message?