简体   繁体   English

警告在Facebook SDK中显示无会话请求

[英]warning showing sessionless request in facebook sdk

I am creating a libgdx game and to add social features to the game I am adding Facebook SDK but I always get a warning in logcat stating: "Warning: Sessionless Request needs token but missing either application ID or client token.". 我正在创建一个libgdx游戏,并向该游戏添加了社交功能。我正在添加Facebook SDK,但是我总是在logcat中收到一条警告,指出:“警告:无会话请求需要令牌,但缺少应用程序ID或客户端令牌。”

Firstly I tried to add Facebook feature as given on " http://rotatingcanvas.com/post-game-score-in-facebook-from-android/ " but later I came to know that Facebook class is now almost deprecated. 首先,我尝试添加“ http://rotatingcanvas.com/post-game-score-in-facebook-from-android/ ”中给出的Facebook功能,但后来我知道Facebook类别现在已几乎被弃用。

Then I wrote the code from scratch by looking at documentaion given on developers.facebook.com but it still shows same warning and later I used android-simple-facebook library to implement Facebook feature but still it showing same warning and also the access token is always empty. 然后,我通过查看developers.facebook.com上提供的documentaion从头开始编写了代码,但是它仍然显示相同的警告,后来我使用android-simple-facebook库实现了Facebook功能,但仍然显示了相同的警告,并且访问令牌是总是空的。

What could possibly be the problem? 可能是什么问题?

On my Facebook developer account I am using a test app and also a test user and trying to login to that test user through that test app. 在我的Facebook开发人员帐户上,我同时使用测试应用程序和测试用户,并尝试通过该测试应用程序登录到该测试用户。 But it always shows the same problem , where I could be possibly wrong?? 但是它总是显示相同的问题,在哪里我可能错了? Thanks 谢谢

It may be due to Session not completly setup. 可能是因为会话未完全设置。 Possibly you are implementing the facebook sdk in a fragment, if so then onActivityResult in which you are to override in the fragment will not be called by the facebook sdk, rather it will call the onActivityResult of the Fragment Activity.. You should rather call the onActivityResult of the fragment from the fragment activity onActivityResult. 可能是您在一个片段中实现了Facebook sdk,如果是这样,那么在Facebook sdk中将不会调用您要在片段中覆盖的onActivityResult,而是会调用Fragment Activity的onActivityResult。您应该调用来自片段活动onActivityResult的片段的onActivityResult。

Remove onActivityResult from Fragment then add method on Activity page 从Fragment中删除onActivityResult,然后在“活动”页面上添加方法

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}

It works for me !!!!! 这个对我有用 !!!!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM