【问题标题】:Get User Name and profile picture in twitter在 twitter 中获取用户名和头像
【发布时间】:2016-11-21 00:57:24
【问题描述】:

我已经使用结构实现了 Twitter 登录。但没有获得个人资料图片和更多信息,如电子邮件地址等。 我已经为此实现了以下代码

[[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]);
    }
}];

我只得到用户名和用户 ID。从上面的代码。 所以,我已经为此实现了另一个代码

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);




}];

但仍然获得数据和响应的空值,并在 connectionError 中被禁止 (403)。

【问题讨论】:

    标签: ios objective-c iphone twitter ios9


    【解决方案1】:

    来自 Fabric 的 Mike。

    403 表示您无权获取此信息。需要特别请求电子邮件地址权限,因为您的密钥需要额外的权限。正如documentation 中所述,“请求用户的电子邮件地址需要您的应用程序被 Twitter 列入白名单。要请求访问权限,请访问 https://support.twitter.com/forms/platform。”

    【讨论】:

      猜你喜欢
      • 2021-11-17
      • 1970-01-01
      • 1970-01-01
      • 2011-06-11
      • 1970-01-01
      • 2013-03-18
      • 2016-04-18
      • 2013-01-13
      • 1970-01-01
      相关资源
      最近更新 更多