Android Twitter4j 在转发或发送消息时出现错误
我正在使用 Twitter4j API 制作一个用于 Twitter 集成的应用程序。
现在我的问题是, 当我尝试转发或发送直接消息时,例如:
twitter.retweetStatus(sid); twitter.sendDirectMessage(uid, msg);
我收到以下错误:
> 08-20 11:11:17.409: WARN/System.err(233): 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
> (http://support.twitter.com/forums/10711/entries/15364). 08-20
> 11:11:17.409: WARN/System.err(233): Relevant discussions can be on the
> Internet at: 08-20 11:11:17.409: WARN/System.err(233):
> http://www.google.co.jp/search?q=dbd7edaf or 08-20 11:11:17.409:
> WARN/System.err(233): http://www.google.co.jp/search?q=012e63a7
> 08-20 11:11:17.409: WARN/System.err(233):
> TwitterException{exceptionCode=[dbd7edaf-012e63a7], statusCode=403,
> retryAfter=0, rateLimitStatus=null, version=2.1.11} 08-20
> 11:11:17.409: WARN/System.err(233): at
> twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:199)
> 08-20 11:11:17.419: WARN/System.err(233): at
> twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:75)
> 08-20 11:11:17.419: WARN/System.err(233): at
> twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:128)
> 08-20 11:11:17.419: WARN/System.err(233): at
> twitter4j.Twitter.retweetStatus(Twitter.java:661) 08-20 11:11:17.419:
> WARN/System.err(233): at
> com.openxcell.zoodig.TimelineRe$3.onClick(TimelineRe.java:98) 08-20
> 11:11:17.419: WARN/System.err(233): at
> android.view.View.performClick(View.java:2344) 08-20 11:11:17.419:
> WARN/System.err(233): at
> android.view.View.onTouchEvent(View.java:4133) 08-20 11:11:17.419:
> WARN/System.err(233): at
> android.widget.TextView.onTouchEvent(TextView.java:6510) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.View.dispatchTouchEvent(View.java:3672) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.439: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.439: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.439: WARN/System.err(233): at
> com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
> 08-20 11:11:17.439: WARN/System.err(233): at
> com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1202)
> 08-20 11:11:17.439: WARN/System.err(233): at
> android.app.Activity.dispatchTouchEvent(Activity.java:1987) 08-20
> 11:11:17.439: WARN/System.err(233): at
> com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
> 08-20 11:11:17.439: WARN/System.err(233): at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1658) 08-20
> 11:11:17.449: WARN/System.err(233): at
> android.os.Handler.dispatchMessage(Handler.java:99) 08-20
> 11:11:17.449: WARN/System.err(233): at
> android.os.Looper.loop(Looper.java:123) 08-20 11:11:17.449:
> WARN/System.err(233): at
> android.app.ActivityThread.main(ActivityThread.java:4203) 08-20
> 11:11:17.449: WARN/System.err(233): at
> java.lang.reflect.Method.invokeNative(Native Method) 08-20
> 11:11:17.449: WARN/System.err(233): at
> java.lang.reflect.Method.invoke(Method.java:521) 08-20 11:11:17.459:
> WARN/System.err(233): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
> 08-20 11:11:17.470: WARN/System.err(233): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 08-20
> 11:11:17.470: WARN/System.err(233): at
> dalvik.system.NativeStart.main(Native Method)
任何人都可以告诉我为什么会收到此错误吗? api有什么问题吗? 或者我在哪里犯错了?
任何有关此问题的帮助将不胜感激..
谢谢, 马尤尔·帕雷克
I am making an app for twitter integration using Twitter4j API.
Right now my problem is,
when i tried to make retweet or send direct messages like:
twitter.retweetStatus(sid);
twitter.sendDirectMessage(uid, msg);
i got the following error:
> 08-20 11:11:17.409: WARN/System.err(233): 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
> (http://support.twitter.com/forums/10711/entries/15364). 08-20
> 11:11:17.409: WARN/System.err(233): Relevant discussions can be on the
> Internet at: 08-20 11:11:17.409: WARN/System.err(233):
> http://www.google.co.jp/search?q=dbd7edaf or 08-20 11:11:17.409:
> WARN/System.err(233): http://www.google.co.jp/search?q=012e63a7
> 08-20 11:11:17.409: WARN/System.err(233):
> TwitterException{exceptionCode=[dbd7edaf-012e63a7], statusCode=403,
> retryAfter=0, rateLimitStatus=null, version=2.1.11} 08-20
> 11:11:17.409: WARN/System.err(233): at
> twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:199)
> 08-20 11:11:17.419: WARN/System.err(233): at
> twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:75)
> 08-20 11:11:17.419: WARN/System.err(233): at
> twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:128)
> 08-20 11:11:17.419: WARN/System.err(233): at
> twitter4j.Twitter.retweetStatus(Twitter.java:661) 08-20 11:11:17.419:
> WARN/System.err(233): at
> com.openxcell.zoodig.TimelineRe$3.onClick(TimelineRe.java:98) 08-20
> 11:11:17.419: WARN/System.err(233): at
> android.view.View.performClick(View.java:2344) 08-20 11:11:17.419:
> WARN/System.err(233): at
> android.view.View.onTouchEvent(View.java:4133) 08-20 11:11:17.419:
> WARN/System.err(233): at
> android.widget.TextView.onTouchEvent(TextView.java:6510) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.View.dispatchTouchEvent(View.java:3672) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.429: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.439: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.439: WARN/System.err(233): at
> android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882) 08-20
> 11:11:17.439: WARN/System.err(233): at
> com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
> 08-20 11:11:17.439: WARN/System.err(233): at
> com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1202)
> 08-20 11:11:17.439: WARN/System.err(233): at
> android.app.Activity.dispatchTouchEvent(Activity.java:1987) 08-20
> 11:11:17.439: WARN/System.err(233): at
> com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
> 08-20 11:11:17.439: WARN/System.err(233): at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1658) 08-20
> 11:11:17.449: WARN/System.err(233): at
> android.os.Handler.dispatchMessage(Handler.java:99) 08-20
> 11:11:17.449: WARN/System.err(233): at
> android.os.Looper.loop(Looper.java:123) 08-20 11:11:17.449:
> WARN/System.err(233): at
> android.app.ActivityThread.main(ActivityThread.java:4203) 08-20
> 11:11:17.449: WARN/System.err(233): at
> java.lang.reflect.Method.invokeNative(Native Method) 08-20
> 11:11:17.449: WARN/System.err(233): at
> java.lang.reflect.Method.invoke(Method.java:521) 08-20 11:11:17.459:
> WARN/System.err(233): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
> 08-20 11:11:17.470: WARN/System.err(233): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 08-20
> 11:11:17.470: WARN/System.err(233): at
> dalvik.system.NativeStart.main(Native Method)
Can anyone please tell me why i am getting this?
is there anything problem with api?
or where i am making mistake?
Any Help Regarding this will be Appreciated..
Thank You,
Mayur Parekh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您提供的堆栈跟踪包含一条消息,告诉您发生了什么。
从堆栈跟踪:
中提供的 链接消息表明存在一些 API 限制。以下是该页面的消息:
以下是各种限制的详细信息:
The stacktrace that you have provided contains a message which tells you what happened.
From the stacktrace:
The link provided in the message suggests that there are some API limits. Here is the message from the page:
Here is the breakdown of the various limits:
就我而言,我收到此错误是因为响应不仅仅是一个
JSON对象
,而是是一个JSON数组
我试图将其直接转换为 JSONObject。所以错误现在已解决。
谢谢@nicholas,你的回答帮助了我很多。
in my case i was getting this error cause the response was not just a
JSON Object
but that was aJSON Array
and i was trying to conver it into JSONObject directly..So the error is resolved now.
Thank You @nicholas your answer helped me alot..
最近我在执行类似的代码时遇到了同样的错误。要修复此问题,请按照以下步骤操作:
你就完成了!您的程序将开始运行。
Recently I got the same error while executing similar code. To fix it, follow these steps:
And you are done! Your program will start working.