How to get twitter profile pic using api 1.1 from iOS?

非 Y 不嫁゛ 提交于 2019-12-04 20:29:18
nst

Here is a solution using STTwitter:

STTwitterAPI *twitter = [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:@"" consumerSecret:@""];

[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {

    [twitter getUsersShowForUserID:nil orScreenName:@"barackobama" includeEntities:nil successBlock:^(NSDictionary *user) {

        NSString *profileImageURLString = [user valueForKey:@"profile_image_url"];
        NSURL *url = [NSURL URLWithString:profileImageURLString];
        UIImage *profileImage = [UIImage imageWithContentsOfURL:url];

    } errorBlock:^(NSError *error) {
        //
    }];

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