1

I am developing an iOS app where i use Social.framework and Accounts.farmework to get Twitter account information.I am getting all the necessary info but not the Email address of the account. After googling i am confuse is it really available? Need help.

Sofeda
  • 1,361
  • 1
  • 13
  • 23

2 Answers2

0

Yes, you can get user the information. Check out this!

Community
  • 1
  • 1
Jay Bhalani
  • 4,142
  • 8
  • 37
  • 50
0

To request a user’s email, call the TwitterAuthClient#requestEmail method, passing in a valid TwitterSession and Callback.

    TwitterAuthClient authClient = new TwitterAuthClient();
authClient.requestEmail(session, new Callback() {
    @Override
    public void success(Result result) {
        // Do something with the result, which provides
        // the email address
    }

    @Override
    public void failure(TwitterException exception) {
      // Do something on failure
    }
});

Click 'Allow' when asked to 'Share your Email Address'.

If the user grants access and the email address is available, the success method is called with the email address in the result.

If the user denies access, the failure method will be called instead.

Note that even if the user grants access to her email address, it is not guaranteed you will get an email address. For example, if someone signed up for Twitter with a phone number instead of an email address, the email field may be empty. When this happens, the failure method will be called because there is no email address available.

mars
  • 1,651
  • 2
  • 15
  • 20