iostwittertwitter-oauthtwitter-fabric

How would I get my App whitelisted on Twitter to get user email?


I am developing an iOS App and want to request a user to share his/her email address. I have used Twitter kit framework for authenticating user. That part of my App has been done successfully. Now, I want to request user email. I have referred to Twitter developers documentation telling me to visit a form to get information to get my App white-listed. In that form, I couldn’t found an option for requesting a user’s email.

So, I need some guidance for the process for achieving this. Twitter should have given a straight forward information about this.


Solution

  • Finally, after having a long conversation with sdk-feedback@twitter.com, I got my App whitelisted. Here is the story:

    1. On the 'Settings' tab, add a terms of service and privacy policy URL
    2. On the 'Permissions' tab, change your token's scope to request email. This option will only been seen, once your App gets whitelisted.

    It's time to code:

    -(void)requestUserEmail
    {
        if ([[Twitter sharedInstance] session]) {
            
            TWTRShareEmailViewController *shareEmailViewController =
            [[TWTRShareEmailViewController alloc]
             initWithCompletion:^(NSString *email, NSError *error) {
                 NSLog(@"Email %@ | Error: %@", email, error);
             }];
            
            [self presentViewController:shareEmailViewController
                               animated:YES
                             completion:nil];
        } else {
            // Handle user not signed in (e.g. attempt to log in or show an alert)
        }
    }