Fetch Twitter Friend List after Authentification

淺唱寂寞╮ 提交于 2019-12-12 05:30:36

问题


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:


- (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 !!



来源:https://stackoverflow.com/questions/9194514/fetch-twitter-friend-list-after-authentification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!