I have kept the Status flag of FB.Init() as true. Still after I quit my app , FB never logs back again.I have to re-login everytime. Although it says that it'll attempt to relogin from a valid session data. What am I missing here?
Here's the code:
private void CallFBInit()
{
FB.Init(OnInitComplete, OnHideUnity);
}
private void OnInitComplete()
{
if (FB.IsLoggedIn)
{
Debug.Log ("Loggedin userid: " + FB.UserId);
return;
}
}
private void OnHideUnity(bool isGameShown)
{
if (!isGameShown)
{
// pause the game - we will need to hide
Time.timeScale = 0;
}
else
{
// start the game back up - we're getting focus again
Time.timeScale = 1;
}
}
private void LoginFB()
{
FB.Login("email,public_profile, user_friends", LoginCallback);
}
private void LogoutFB()
{
if (FB.IsLoggedIn)
{
FB.Logout();
}
}
private void LoginCallback(FBResult result)
{
// Call Cognito Login for FB as well
AWSManager.FacebookLoginCallback (result);
if (result.Error != null)
{
}
else if (!FB.IsLoggedIn)
{
}
else if(FB.IsLoggedIn)
{
}
}
public void OnClickedOnFBButton()
{
//Debug.Log ("clicked on facebook button");
if(FB.IsLoggedIn)
{
return;
}
LoginFB ();
}
EDIT: It's only giving issues on iOS , works fine on Android.
Aucun commentaire:
Enregistrer un commentaire