简体   繁体   中英

How to get Twitter account Email address using SLRequest or ACAccount?

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM