How to get twitter profile picture in ios?

后端 未结 6 1858
悲哀的现实
悲哀的现实 2021-01-03 02:43

I wrote the following code:

NSURL *url = [NSURL URLWithString:@\"http://api.twitter.com/1.1/users/show.json\"];

NSDictionary *params = [NSDictionary diction         


        
6条回答
  •  庸人自扰
    2021-01-03 03:20

    try this one ,it's latest for getting the user profile using fabricSDK

      -(void)usersShow:(NSString *)userID
    {
        NSString *statusesShowEndpoint = @"https://api.twitter.com/1.1/users/show.json";
        NSDictionary *params = @{@"user_id": userID};
    
        NSError *clientError;
        NSURLRequest *request = [[[Twitter sharedInstance] APIClient]
                                 URLRequestWithMethod:@"GET"
                                 URL:statusesShowEndpoint
                                 parameters:params
                                 error:&clientError];
    
        if (request) {
            [[[Twitter sharedInstance] APIClient]
             sendTwitterRequest:request
             completion:^(NSURLResponse *response,
                          NSData *data,
                          NSError *connectionError) {
                 if (data) {
                     // handle the response data e.g.
                     NSError *jsonError;
                     NSDictionary *json = [NSJSONSerialization
                                           JSONObjectWithData:data
                                           options:0
                                           error:&jsonError];
    
                     NSLog(@"%@",[json description]);
                 }
                 else {
                     NSLog(@"Error code: %ld | Error description: %@", (long)[connectionError code], [connectionError localizedDescription]);
                 }
             }];
        }
        else {
            NSLog(@"Error: %@", clientError);
        }
    }
    

提交回复
热议问题