脸谱,机器人java.lang.IllegalStateException:无法执行的任务:任务已经运行任务、脸谱、机器人、java

2023-09-04 08:43:48 作者:后来呢

登录后,我可以,我可以做FB查询。几分钟(扮演游戏)的Facebook请求后失败的异常:

After login I can I can make FB queries. After few minutes (played game) Facebook requests fail exception:

java.lang.IllegalStateException: Cannot execute task: the task is already running

当我把它称为失败

        Request.executeMeRequestAsync(Session.getActiveSession(),
                new Request.GraphUserCallback() {...

        Request.executeGraphPathRequestAsync(Session.getActiveSession(),
                "me/apprequests", new Request.Callback() {...

        Request request = new Request(session, "me/apprequests", null,
                    null, new Request.Callback() { .... } );
        RequestAsyncTask status = request.executeAsync();

同样的呼叫将被立即登录后,他们的工作叫。 我有一个测试应用程序,它的工作原理。但在登陆后几分钟后真正的应用程序这是行不通的。

Same calls are called immediately after login and they work. I have a test app where it works. But in real app after few minutes after login it does not work.

推荐答案

您运行的UI线程?与 runOnUiThread

Are you running on UI thread? Wrap your code withrunOnUiThread

像this

Facebook的SDK 提到的异步调​​用必须从UI线程来完成

Facebook SDK mentions that async calls must be done from UI thread