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 6906989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:22:48+00:00 2026-05-27T08:22:48+00:00

I am doing a Twitter App using the Twitter iOS 5 Framwork and it

  • 0

I am doing a Twitter App using the Twitter iOS 5 Framwork and it works quite well.
I am searching for all available TwitterAccounts on the device and load them into a tableview to display them. If the user touches on a account the next view is loaded and all followers are requested via the REST API and loaded into a array to parse each name and photo using the REST API. The problem is, the request isn’t asynchronous and I am first getting a nil array and then getting the response of the API.

The requestMethod is the following:

__block NSArray *responseArray;

NSURL *tweetURL = [NSURL URLWithString:@"https://api.twitter.com/1/followers/ids.json"];

NSString *username = [[[self getAvailableTwitterAccounts] objectAtIndex:user] username];

NSMutableDictionary *parameters = [[NSMutableDictionary alloc] 
                                   initWithObjects:[NSArray arrayWithObjects:@"-1", username, @"1", nil]
                                   forKeys:[NSArray arrayWithObjects:@"cursor", @"username", @"stringify_ids" ,nil]];

//Build request
TWRequest *getFollowerRequest = [[TWRequest alloc] initWithURL:tweetURL 
                                                    parameters:parameters
                                                    requestMethod:TWRequestMethodGET];

[getFollowerRequest setAccount:[[self getAvailableTwitterAccounts] objectAtIndex:user]];
[getFollowerRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error){
    dispatch_async(dispatch_get_main_queue(), ^{
        NSError *jsonParsingError = nil;
        NSDictionary *response = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonParsingError];
        responseArray = [response objectForKey:@"ids"];
        NSLog(@"responseArray %@ for user: %@",responseArray,username);
  });  
}];

return responseArray;
}

and the loading process:

- (void)viewWillAppear:(BOOL)animated
{   

followerIDArray = [[NSArray alloc] initWithArray:[[NBNTwitterConnect sharedTwitterConnect] getFollowerIDsForUser:userID]];
[super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self initDisplayArray];
}

-(void)initDisplayArray{

NSLog(@"followerIDArray: %@",followerIDArray);

[self performSelectorOnMainThread:@selector(arrayDidFinishedLoading:) withObject:nil waitUntilDone:NO];
}

-(void)arrayDidFinishedLoading:(NSArray *)array{

[self.tableView reloadData];
}

and the Output:

followerIDArray: (
)
2011-12-03 21:43:33.305 NBNTwitterChat[1858:10403] responseArray (
3840,
14064174,
281136865,
224987906
) for user:xyz 

Can anyone assist me with that? I searched the whole web and I need to use the TWRequest method and not the asihttprequest or something else.

  • 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-05-27T08:22:48+00:00Added an answer on May 27, 2026 at 8:22 am

    Actually I’d say that it is asynchronous, which is causing the problem.

    -[TWRequest performRequestWithHandler:] is an asynchronous method that will return instantly. You cannot return responseArray like you do, since it won’t be filled before leaving the function.

    You will have to write asynchronous code, or you will have to use -[TWRequest signedURLRequest] and do a synchronous request.

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

Sidebar

Related Questions

I'd like to do OAuth for Twitter from an iPhone app. But doing so
for the page I am doing needs a login authentication using Twitter (using tweetphp
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I'm using sharekit in my iphone app to send text to twitter, but i
I was doing FB and Twitter integration of my application using the ShareKit. Which
I am using ShareKit in my iOS App . I have set everything properly
I am writing an app using WPF 3.5 and I need twitter integration. I
I am doing a custom title for my android app and I want to
I'm implementing a web app, which uses sessions. I'm using GWT and app engine
I am developing an iPhone app, which now can update Twitter account with GPS

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.