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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:55:19+00:00 2026-06-10T12:55:19+00:00

I am using Twitter and Accounts Framework for iOS 5. Problem is that i

  • 0

I am using Twitter and Accounts Framework for iOS 5.
Problem is that i am not able to get the list of friends using http://api.twitter.com/1/friends/ids.json?screen_name=%@” this api. But from twitter api explorer, i got the friends list. (twitter explorer api = https://dev.twitter.com/console ).

  • 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-10T12:55:20+00:00Added an answer on June 10, 2026 at 12:55 pm

    I am using Twitter Native Framework for iOS.

    To getting friends list from Twitter you can go this way (Four Steps).

    1. Add Twitter and Accounts Framework to project.
    2. Get The Current Twitter Account Instance.
    3. Then you will get the Friends ID list from Twitter through API
      Request.
    4. And finally you can get the Friends Name or other data via ID and
      put in Array

    so…your .h file should look like this

    #import <UIKit/UIKit.h>
    #import <Twitter/Twitter.h>
    #import <Accounts/Accounts.h>
    
    @interface LoginView : UIViewController{    
    
        ACAccount *myAccount;  
        NSMutableString *paramString;  
        NSMutableArray *resultFollowersNameList;
    }
    
    @property(nonatomic,retain) ACAccount *myAccount;
    @property(nonatomic, retain) NSMutableString *paramString;
    @property(nonatomic, retain) NSMutableArray *resultFollowersNameList;
    

    and your .m file should have like this..

    Get The Twitter Account Instance
    /******To check whether More then Twitter Accounts setup on device or not *****/
    
    -(void)getTwitterAccounts {
    
        ACAccountStore *accountStore = [[ACAccountStore alloc] init];    
        ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];   
        [accountStore requestAccessToAccountsWithType:accountType
                                withCompletionHandler:^(BOOL granted, NSError *error) {
    
        if (granted && !error) {
            accountsList = [accountStore accountsWithAccountType:accountType]; 
    
            int NoOfAccounts = [accountsList count]; 
    
            if (NoOfAccounts > 1) {      
    
                NSLog(@"device has more then one twitter accounts %i",NoOfAccounts);
    
            } 
            else 
            {
                myAccount = [accountsList objectAtIndex:0];             
                NSLog(@"device has single twitter account : 0");           
    
            }
        } 
        else 
        {
            // show alert with information that the user has not granted your app access, etc.
        }                                
    
      }];
    }
    
    
    /************* getting followers/friends ID list code start here *******/
    // so far we have instnce of current account, that is myAccount //
    
    -(void) getTwitterFriendsIDListForThisAccount{
    
        /*** url for all friends *****/
        // NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/friends/ids.json"]; 
    
        /*** url for Followers only ****/
        NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/followers/ids.json"]; 
    
        NSDictionary *p = [NSDictionary dictionaryWithObjectsAndKeys:myAccount.username, @"screen_name", nil];
    
        TWRequest *twitterRequest = [[TWRequest alloc] initWithURL:url parameters:p requestMethod:TWRequestMethodGET];
        [twitterRequest setAccount:myAccount];
        [twitterRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResposnse, NSError *error)
         {
             if (error) {
    
             }
             NSError *jsonError = nil;
             // Convert the response into a dictionary
             NSDictionary *twitterFriends = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONWritingPrettyPrinted error:&jsonError];         
    
             NSArray *IDlist = [twitterFriends objectForKey:@"ids"];
    
             NSLog(@"response value is: %@", IDlist);        
    
             int count = IDlist.count;         
             for (int i=0; i<count; i++ ) {    
    
    
                 [paramString appendFormat:@"%@",[IDlist objectAtIndex:i]];             
    
                 if (i <count-1) {
                     NSString *delimeter = @",";
                     [paramString appendString:delimeter];
                 }
    
             }
    
             NSLog(@"The mutable string is %@", paramString);
             [self getFollowerNameFromID:paramString];
         }
         ];
    
    }
    
    
    -(void) getFollowerNameFromID:(NSString *)ID{
    
    
        NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1/users/lookup.json"];
        NSDictionary *p = [NSDictionary dictionaryWithObjectsAndKeys:ID, @"user_id",nil];
        NSLog(@"make a request for ID %@",p);
    
        TWRequest *twitterRequest = [[TWRequest alloc] initWithURL:url
                                                        parameters:p
                                                     requestMethod:TWRequestMethodGET];    
       [twitterRequest setAccount:myAccount];
    
    
        [twitterRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
            if (error) {
    
            }
            NSError *jsonError = nil;       
    
    
            NSDictionary *friendsdata = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONWritingPrettyPrinted error:&jsonError];
         //  NSLog(@"friendsdata value is %@", friendsdata);
    
    
         //  resultFollowersNameList = [[NSArray alloc]init];
           resultFollowersNameList = [friendsdata valueForKey:@"name"];
            NSLog(@"resultNameList value is %@", resultFollowersNameList);
    
    
        }];        
    
    }
    

    let me know if you have any doubt regarding this!!
    happy to help!

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

Sidebar

Related Questions

I'm using the Accounts framework from the iOS SDK to handle twitter requests. When
I know that to get access to a configured twitter account using twitter framework
I just started using Twitter Bootstrap http://twitter.github.com/bootstrap/scaffolding.html and I'm looking for the grey/blue navbar
I'm developing a little Twitter application on iOS 5. I'm using Twitter and Accounts
I'm using the following code to get the user details from Twitter in iOS
[pre-able] In my www.twipler.com project I want to allow people to link Twitter accounts.
Trying to follow someone on Twitter using new iOS 5 API, getting 406 return
Is there a way to select multiple accounts to share to using http://getsharekit.com ?
I'm using Twitter's OAuth API to updates a user's twitter account (twitter status update)
I am using Twitter Bootstrap, (CSS and JS). The problem comes from the Modal

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.