我想在Android应用上发推文。我在adroid中创建app并且我允许读写。 我得到了令牌和消费者钥匙, 我写这段代码:
String token ="<Your access token>";
String secret = "<Your access token secret>";
AccessToken a = new AccessToken(token,secret);
Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer("<Your consumer key>", "<Your consumer secret>");
twitter.setOAuthAccessToken(a);
try {
twitter.updateStatus("android test");
} catch (TwitterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
但它给出了错误:
403:The request is understood, but it has been refused.
An accompanying error message will explain why.
This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
Relevant discussions can be on the Internet at:
http://www.google.co.jp/search?q=b2b52c28
or
http://www.google.co.jp/search?q=1b442886
TwitterException{exceptionCode=[b2b52c28-1b442886], statusCode=403, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5}
我该如何解决这个问题?
答案 0 :(得分:1)
您获得此异常可能是因为早期版本的twitter4j库。我建议您将库升级到最新版本(twitter4j-core-3.0.5.jar).