【问题标题】:TwitterKit framework is not getting email keyTwitterKit 框架没有获得电子邮件密钥
【发布时间】:2017-02-15 13:02:32
【问题描述】:

我正在使用 Fabric 的 TwitterKit 框架和 2.8.0 版本。我已按照https://docs.fabric.io/apple/twitter/log-in-with-twitter.html#request-user-email-address 的说明进行操作 并且已经检查了向用户请求电子邮件地址访问权限的权限。但有时我根本没有收到“verify_credentials”响应,有时我在 verify_credentials API 响应中没有收到“email”密钥。

【问题讨论】:

    标签: ios objective-c twitter-fabric twitterkit


    【解决方案1】:

    使用 Fabric 登录 Twitter。请使用以下代码

      - (IBAction)TwitteClickAction:(id)sender
       {
    
        [[Twitter sharedInstance] logInWithMethods:TWTRLoginMethodWebBased completion:^(TWTRSession *session, NSError *error)
       {
        if (session)
        {
            NSLog(@"signed in as %@", [session userName]);
            NSLog(@"signed id in as %@", [session userID]);
            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)
            {
                if (data)
                {
                    NSError *jsonError;
                    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
                    NSLog(@"info is ====>%@",json);
    
                }
                else {
                    NSLog(@"Error: %@", connectionError);
                } 
            }];
    
        } else {
            NSLog(@"error: %@", [error localizedDescription]);
        }
      }];    
      }
    

    【讨论】:

    • 谢谢,我刚刚忘记提及基于网络的方法。
    猜你喜欢
    • 2017-12-12
    • 2010-11-14
    • 2012-03-09
    • 2011-10-07
    • 1970-01-01
    • 2014-08-19
    • 2017-11-24
    • 1970-01-01
    • 2010-11-22
    相关资源
    最近更新 更多