Twitter API : How to get a list of users that a Twitter's user follow (MGTwitterEngine for Obj-C)

柔情痞子 提交于 2019-12-24 07:58:02

问题


I'm wondering if I'm allowed to get a list of friends that a twitter's user follow (following list) through MGTwitterEngine for Obj-C ?

If it's possible, please direct me how to do it Thanks


回答1:


You're allowed. MGTwitterEngine has sample code for their methods in AppController.m. This is the method for retrieving a list of who anyone is following.

[twitterEngine getFriendIDsFor:@"username_here" startingFromCursor:-1]



回答2:


ADD this to MGTwitterEngine.h along with followers methods

- (NSString *)getFollowingIncludingCurrentStatus:(BOOL)flag;

AND this to MGTwitterEngine.m along with followers methods

- (NSString *)getFollowingIncludingCurrentStatus:(BOOL)flag
{
    NSString *path = [NSString stringWithFormat:@"statuses/friends.%@", API_FORMAT];

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
    if (!flag) {
        [params setObject:@"true" forKey:@"lite"]; // slightly bizarre, but correct.
    }

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


来源:https://stackoverflow.com/questions/4210806/twitter-api-how-to-get-a-list-of-users-that-a-twitters-user-follow-mgtwitter

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