简体   繁体   English

在Twitter中获取用户名和个人资料图片

[英]Get User Name and profile picture in twitter

I have implemented Twitter Login using fabric. 我已经使用结构实现了Twitter登录。 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. 我只有用户名和用户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. 但仍会获得数据的空值并进行响应,并在connectionError中被禁止(403)。

Mike from Fabric here. 来自Fabric的Mike。

A 403 means you don't have the permissions to get this information. 403表示您无权获取此信息。 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 ." 文档中所述,“请求用户的电子邮件地址要求您的应用程序被Twitter列入白名单。要请求访问权限,请访问https://support.twitter.com/forms/platform 。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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