Hi Taurus,
I looked into your code and found that you are trying to do something like that ::
1) Connect With Facebook by using method DoFBOAuthAndGetToken.
2) Fetching User Details by using method GetFacebookProfile.
3) Linking User Facebook Account by using method LinkUserFacebookAccount.
4) Updating Facebook Status by usin method UpdateFacebookStatus.
For doing the same I edited your AppController.cs and LeaderBoardCallBack.cs files with below code snippet :
AppController.cs changes ::
// Update is called once per frame
void Update () {
if (!LeaderBoardCallBack.fbAccessToken.Equals ("") && LeaderBoardCallBack.isConnected) {
Debug.Log ("====================ACCESS TOKEN RECIEVED========================");
LeaderBoardCallBack.isConnected = false;
AppConstants.GetSocialService ().GetFacebookProfile (LeaderBoardCallBack.fbAccessToken, new LeaderBoardCallBack ());
}
if (LeaderBoardCallBack.isUserDetailsRecieved) {
Debug.Log ("====================USER DETAILS RECIEVED========================");
LeaderBoardCallBack.isUserDetailsRecieved = false;
AppConstants.GetSocialService ().LinkUserFacebookAccount(LeaderBoardCallBack.fbUserName, LeaderBoardCallBack.fbAccessToken, new LinkFBUserCallBack());
}
}
void OnGUI ()
{
if (GUILayout.Button ("ConnectWithFacebook", GUILayout.Width(300), GUILayout.Height(100))) {
FacebookService.ConnectWithFacebook();
}
if (GUILayout.Button ("UpdateFacebookStatus", GUILayout.Width(300), GUILayout.Height(100))) {
AppConstants.GetSocialService ().UpdateFacebookStatus(LeaderBoardCallBack.fbUserName, "App42 Unity3D", new ShareCallBack());
}
}
LeaderBoardCallBack.cs changes ::
public static string fbUserName = "";
public static string fbUserProfilePic = "";
public static string fbUserId = "";
public static bool isConnected = false;
public static bool isUserDetailsRecieved = false; // this line is added.
if (response is com.shephertz.app42.paas.sdk.csharp.social.Social){
com.shephertz.app42.paas.sdk.csharp.social.Social socialObj = (com.shephertz.app42.paas.sdk.csharp.social.Social)response;
Debug.Log("Social (leaderboard) :: "+socialObj.ToString());
LeaderBoardCallBack.fbUserName = socialObj.GetFacebookProfile().GetName();
LeaderBoardCallBack.fbUserProfilePic = socialObj.GetFacebookProfile().GetPicture();
LeaderBoardCallBack.fbUserId = socialObj.GetFacebookProfile().GetId();
isUserDetailsRecieved = true; // this line is added.
}