Fetch Twitter Friend List after Authentification

2019-08-29 19:41发布

I've used the following method from MGTwitterEngine.m in order to fetch the friend list:

(NSString *)getFriendsIds:(NSString *)twitterID
{
    NSString *path = [NSString stringWithFormat:@"friends/ids.%@", API_FORMAT];

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
    [params setObject:twitterID forKey:@"user_id"];

    return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil 
                            requestType:MGTwitterUserInformationRequest
                           responseType:MGTwitterUsers];
}

And in my class I've made the following call:

NSLog(@"friends %@",[_engine getFriendsIds:@"user_id"]);

I couldn't retreive the friend list.

1条回答
走好不送
2楼-- · 2019-08-29 20:38
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier {

    //NSLog(@"User Info Received: %@", userInfo);

    followTweet = [[TweetFollow alloc]initWithStyle:UITableViewStylePlain];//Table

    TweetModel *tweetFollw = [[TweetModel alloc]initWithTweetFollwerArray:userInfo];//Model
    [followTweet.tweetFollow addObject:tweetFollw];

    NSLog(@"ARRYYYYYY: %@",followTweet.tweetFollow );
    followTweet.view.frame = CGRectMake(161, 0, 160, 420);
    [self.view addSubview:followTweet.view];
    [tweetFollw release];

}



#define TWITTER_DOMAIN @"api.twitter.com/1"  // Plz change this in to MGTwitterEngin.m

-(void)viewWillApper {

//_engine is instance of MGTwitterEngin class
[_engine getFollowersIncludingCurrentStatus:NO];

}

This is simple code by which you can get the twitter Friend list ; Thank you !!

查看更多
登录 后发表回答