Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8264561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:30:16+00:00 2026-06-08T04:30:16+00:00

Once a user has tweeted something, I need to differentiate which twitter account he

  • 0

Once a user has tweeted something, I need to differentiate which twitter account he used. Lets consider that the user would have 1 or several accounts configured on the phone.

I need tho know this after the tweet is successful, so the proper place would be the callback. I tried to fetch the accounts using ACAccountStore but it provides an array with all the accounts set up on the phone, not a clue about the last account used (not even the order of the array).

Does anyone knows if TWTweetComposeViewController remembers this account and, how to fetch it?

Thanks

My code:

if ([TWTweetComposeViewController canSendTweet])
{
    TWTweetComposeViewController *tweetSheet = 
    [[TWTweetComposeViewController alloc] init];
    [tweetSheet setInitialText:@"initial text"];
    [tweetSheet addImage:[UIImage imageNamed:image]];

    // Callback
    tweetSheet.completionHandler = ^(TWTweetComposeViewControllerResult result) {
        // if tweet was successful
        if(result == TWTweetComposeViewControllerResultDone) {

            // Get the accounts
            account = [[ACAccountStore alloc] init];
            ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

            [account requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) 
             {
                 // if access granted I populate the array
                 if (granted == YES) {
                     NSArray *arrayOfAccounts = [account accountsWithAccountType:accountType];

                     ACAccount *account1 = [arrayOfAccounts objectAtIndex:0];
                     ACAccount *account2 = [arrayOfAccounts objectAtIndex:1];

                     NSString *username1 = account1.username;
                     NSString *username2 = account2.username;

                     // Always same order
                     NSLog(userName1);
                     NSLog(userName2);

                 }
             }];

            [self furtherMethodsInCaseOfSuccessfulTweet];


        } else if(result == TWTweetComposeViewControllerResultCancelled) {
            NSLog(@"twit canceled");
        }
        [self dismissViewControllerAnimated:YES completion:nil];
    };


    [self presentModalViewController:tweetSheet animated:YES];

}
else
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"No tweet is possible on this device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [alertView show];

}   

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:30:18+00:00Added an answer on June 8, 2026 at 4:30 am

    I found a way.

    Instead looking for the username on the insctance of TWTweetComposeViewController , lets use GET users/lookup to qwery the names gathered by ACAccountStore.

    http://api.twitter.com/1/users/lookup.xml?screen_name=username1,username2
    (use json instead xml)

    Parsing the results we can get the date/time of the last tweet of the users (“status” tag), and voila, we have the last account used.
    In additiom, you can test the qwery results on the console.

    Thanks to @theSeanCook

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is crazy, but I'm stumped! Once my user has logged into twitter via
I have a webpage that requires login. Once a user has logged in I
Once a user has selected a file with the open file dialog, how can
I have the following route: {language}/{controller}.mvc/{action}/{id} Once a user has choosen the language it
I need to hide a form on my page once a user submits it.
We have a scenario in which we like to detect when the user has
Once a user has selected a song in the picker, is there a way
What I'd like to do is once the user has selected an item from
Essentially what I want is for the app, once the user has allowed access
My C# WinForms UI has some parameters that the user can adjust using sliders.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.