0

I am using TwitterKit framework by Fabric and the version 2.8.0. I have followed the instructions as per https://docs.fabric.io/apple/twitter/log-in-with-twitter.html#request-user-email-address And the permission to request email address access from a user is already checked. But I am not getting "verify_credentials" response at all sometimes and sometimes I am not getting "email" key in the verify_credentials API response.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
u7568924
  • 83
  • 1
  • 9

1 Answers1

0

Twitter Login by using Fabric. Please use below code

  - (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]);
    }
  }];    
  }
Lalit kumar
  • 1,797
  • 1
  • 8
  • 14