简体   繁体   中英

How to keep logged in facebook with unity SDK

We are trying to keep the same user after closing the application in iOS. We want to keep logged in with the same Facebook user, even if that user has logged out in the Facebook app of the device or another one is logged in. We are using Facebook SDK for Unity 3D.

We are trying to do it this way:

  • The first time that the user is logged we saved the response (json) of the FB.GetAuthResponse method.

  • We close (kill) the application.

  • The next time, when we run the application in the FB.Init method we use the auth response as third parameter.

These steps don't work for us. Is there any way to start login process with the last facebook user who used the application (we're trying to do the same behaviour as in Candy Crush).

Thanks! Best Regards.

Pretty old unanswered question. This answer applies to the version 7.9.4 of the facebook SDK for Unity3d.

The Facebook SDK will remember if the user is logged in, there's no need to try to save that yourself. After FB.Init(), check FB.IsLoggedIn. If it's true just call FB.Mobile.RefreshCurrentAccessToken() and you're good to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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