1

所以我基本上从 Facebook API 教程中复制/粘贴了这段代码,但是当我运行它时,调用 onCompleted() 可能需要超过 60(!)秒,这显然是完全不可接受的。我有几次不到 10 秒,但这是非常罕见的;大部分时间至少需要 30 秒。这不会受到我本地帧率的影响,对吧?我正在加载纹理并渲染加载屏幕,而此请求未决,这会导致渲染出现一些波动,但我认为这不会影响这一点。我也试过模拟器以及多部不同的手机,都遇到同样的问题。如果有人有任何想法或建议,请帮助!

 Session.openActiveSession( this, true, new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception)
        {
            if( session != null && session.isOpened() )
            {
                // make request to the /me API
                Request request = Request.newMeRequest( session,
                        new Request.GraphUserCallback() {
                            // callback after Graph API response with user object

                            @Override
                            public void onCompleted(GraphUser user, Response response)
                            {
                                 // sometimes over 60 seconds to get here!
                            }
                        }
                        );
                Request.executeBatchAsync(request);
            }
        }
    });
4

1 回答 1

0

你可以试试这个...

Session.openActiveSession( this, true, new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception)
        {
            if( session != null && session.isOpened() )
            {
                // make request to the /me API
                Request request = Request.executeMeRequest( session,
                        new Request.GraphUserCallback() {
                            // callback after Graph API response with user object

                            @Override
                            public void onCompleted(GraphUser user, Response response)
                            {}
                        });
            }
        }
    });
于 2013-07-13T20:22:23.730 回答