验证后获取Twitter好友列表

时间:2012-02-08 13:45:48

标签: ios4 twitter mgtwitterengine

我使用MGTwitterEngine.m中的以下方法来获取好友列表:

(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];
}

在我的班上,我做了以下电话:

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

我无法回复朋友名单。

1 个答案:

答案 0 :(得分: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];

}

这是一个简单的代码,您可以通过它获取推特朋友列表; 谢谢!!