Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by username_ · Jul 08, 2014 at 12:55 PM · facebook

Facebook sdk cancelled login crash

Hi

I'm trying to implement the facebook sdk in my game (android, iOS). Login works, all the api calls work, but I get a crash, in the following case:

  • press login

  • facebook login page or if installed, the facebook app comes up properly

  • cancel login

  • goes back to the app properly

  • press login again, and it will crash

    07-08 14:39:11.172: E/AndroidRuntime(23699): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackage/com.facebook.unity.FBUnityLoginActivity}: java.lang.UnsupportedOperationException: Session: an attempt was made to open an already opened session.

I've tried to call logout(which would clear the session) before calling login again, but that did not help.

Any ideas how to fix this?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image yasirkula · Sep 06, 2014 at 10:29 PM 0
Share

Up. Having the same issue.

avatar image Nox Noctis · Sep 18, 2014 at 01:58 PM 0
Share

I'm having this issue right now on android with facebook unity sdk 6.0 August 11, 2014. Anyone?

avatar image Nox Noctis · Sep 18, 2014 at 02:13 PM 0
Share

Ah. Got it: https://developers.facebook.com/bugs/791682207518626/

Ibrahim Faour · Facebook Platform Team: A fix for this issue will be included in the next version of the SD$$anonymous$$ which we will be releasing shortly. August 25 at 1:57pm. How short is "shortly", I wonder...

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Helath · Oct 14, 2014 at 03:31 PM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by dis-s · Oct 24, 2014 at 09:28 AM

Thanks for the classes.jar - it solves the problem!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by LeonardK · Mar 12, 2015 at 07:31 PM

It is also nice idea not to compare java strings using == operator. where appID compared with session.getApplicationId()

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

facebook leaderboard for windows phone 0 Answers

Facebook SDK. Should I fill out "App details" on developers.facebook.com if I want to publish an Android game that uses Unity Facebook SDK on Google Play. 1 Answer

FB.Feed() "properties" argument not working as expected 0 Answers

How to share high score(string)/game result data on facebook ...please any one help me ....:(. 2 Answers

Facebook SDK - Send lives between users - FB.API() problem 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges