简体   繁体   中英

Get User Name and profile picture in twitter

I have implemented Twitter Login using fabric. but not getting profile Picture and much more information like email address, etc. I have implemented Following Code for that

[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error)
{
    [objAppData hideLoader];

    if (session)
    {
        [objAppData hideLoader];
        NSLog(@"signed in as %@", [session userName]);
    }
    else
    {
        [objAppData hideLoader];
        NSLog(@"error: %@", [error localizedDescription]);
    }
}];

I have getting only username and User Id. from above code. so, I have implemented another code for that

TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser];
NSURLRequest *request = [client URLRequestWithMethod:@"GET"
                                                 URL:@"https://api.twitter.com/1.1/account/verify_credentials.json"
                                          parameters:@{@"include_email": @"true", @"skip_status": @"true"}
                                               error:nil];
[client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {


    NSLog(@"%@",data);
     NSLog(@"%@",response);
     NSLog(@"%@",connectionError);




}];

but still getting null value for data and responce and get forbidden (403) in connectionError.

Mike from Fabric here.

A 403 means you don't have the permissions to get this information. Requesting email address permissions needs to be specifically requested as your key needs additional permission for this. As mentioned in the documentation , "Requesting a user's email address requires your application to be whitelisted by Twitter. To request access, please visit https://support.twitter.com/forms/platform ."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM