我正在尝试使用 Twitter 登录请求用户的电子邮件,但它总是返回以下错误
com.twitter.sdk.android.core.TwitterException: Your application may not have access to email addresses or the user may not have an email address. To request access, please visit https://support.twitter.com/forms/platform.
我已按照所有步骤在 fabric 的页面中开发此电子邮件请求。我已请求访问 Twitter,他们已通过确认电子邮件回复我,并且我已在我的 Twitter 应用程序管理控制面板中配置了所有必要的项目,但电子邮件请求总是将我发送到失败方法并抛出该异常。
有什么想法吗?
private void twitterConfig() {
TwitterAuthConfig authConfig =
new TwitterAuthConfig("Consumer Key (API Key)",
"Consumer Secret (API Secret");
Fabric.with(this, new Twitter(authConfig));
twitterLoginButton.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
TwitterSession session = result.data;
String msg = "@" + session.getUserName() + " logged in! (#" + session.getUserId() + ")";
TwitterAuthClient authClient = new TwitterAuthClient();
authClient.requestEmail(session, new Callback<String>() {
@Override
public void success(Result<String> result) {
System.out.println();
}
@Override
public void failure(TwitterException exception) {
notificationManager.showMessage(getString(R.string.error_cant_get_login));
}
});
}
@Override
public void failure(TwitterException exception) {
notificationManager.showMessage(getString(R.string.error_generic));
}
});
}
最佳答案
如 documentation 底部所述:
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.
关于android - 使用 Twitter 请求电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33792109/