how to request permission to retrieve user's email using twitter kit version 1.2.0 in ios8?

前端 未结 5 1097
遥遥无期
遥遥无期 2020-12-05 20:42

I have integrated twitter kit in my ios app by following https://dev.twitter.com/twitter-kit/ios/configure this. I could sign-in after authentication and see my twitter name

5条回答
  •  天命终不由人
    2020-12-05 21:42

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

    • Send mail to sdk-feedback@twitter.com with some details about your App like Consumer key, App Store link of an App, Link to privacy policy, Metadata, Instructions on how to log into our App. Mention in mail that you want to access user email address inside your App.

    • They will review your App and reply to you within 2-3 business days.

    • Once they say that your App is whitelisted, update your App's settings in Twitter Developer portal. Sign in to apps.twitter.com and:

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

    Hope it helps !!!

提交回复
热议问题