facebook unity sdk 6.0 crash app at second login

淺唱寂寞╮ 提交于 2019-12-04 07:23:00

Provided a more permanent solution here on my other account "Helath":

http://answers.unity3d.com/questions/743523/facebook-sdk-cancelled-login-crash.html

Fair Point, Here is the post I made on the other site:

They basically forgot to refresh the session if the state is "Login Failed" along with "Closed".

If you want to, you can import the facebook sdk into eclipse and change line 63 of FBLogin.Java from

if (SessionState.CLOSED.equals(session.getState())) {
            session = new Builder(FB.getUnityActivity()).setApplicationId(session.getApplicationId()).build();
            Session.setActiveSession(session);
        }

to

   if (SessionState.CLOSED.equals(session.getState()) || SessionState.CLOSED_LOGIN_FAILED.equals(session.getState())) {
                session = new Builder(FB.getUnityActivity()).setApplicationId(session.getApplicationId()).build();
                Session.setActiveSession(session);
            }

Then Export the project as a jar, Only including class files, as classes.jar in the Plugins/Android/facebook/bin folder.

EDIT: It might just be easier if I upload the classes.jar I'm using... Download it here: http://speedy.sh/QPgUp/classes.jar And put it in the Plugins/Android/facebook/bin folder.

EDIT 2: If you are still having this issue, Facebook seems to have released their fix on October 20th 2014. So updating to their newest sdk now fixes the issue!

Found an interesting solution for it.

Like I comment in James Baxter's answer, if you call init every time before login, there is no crash even you get the "FB.Init() has already been called. You only need to call this once and only once." error.

But, from the documentation, "This function can only be called once during the lifetime of the object; later calls lead to undefined behavior. ".

The object means the scene? Or another game object?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!