unityengine.social does not contain a definition for "GetUserName"

0 votes

Hi, I am beginner in testing social service of Update status Facebook by using Unity. I have follow the steps that provided in http://api.shephertz.com/app42-docs/social-integration-service/#update-facebook-status. But I have facing the error of unityengine.social does not contain a definition for "GetUserName" and unityengine.social does not contain a definition for "GetStatus". May I know what is the cause of this problem? Hope someone can help me. Thank you.

asked May 3, 2015 in App42 Cloud API-BaaS by greenninjaad2013 (13 points)
recategorized Aug 13, 2015 by sushil
Hi ,
Thanks for having patience. Please let us know which SDK version are you using. This will help us to assist better
Hi,thank you for your reply. Now I am using 2.8 version.

2 Answers

+1 vote

The GetUserName method is not available in the social object because it belongs to UnityEngine.Social and does not contain definition of any App42's methods. You have to cast the response to App42's Social like below code snippet then you'll be able to get all the values.

public void OnSuccess (object response)

{

com.shephertz.app42.paas.sdk.csharp.social.Social socialObj = (com.shephertz.app42.paas.sdk.csharp.social.Social)response;

Debug.Log("Social Response :: "+socialObj.ToString());

String userName = socialObj.GetUserName();

}

 

Let me know if it helps.

 

Thanks

 

answered May 4, 2015 by Akshay.Mishra (179 points)
Thank you for your reply. After I changed the code based on the code that suggested, my app comes out the below exception:
Exception : com.shephertz.app42.paas.sdk.csharp.App42BadParameterException: {"httpErrorCode":"400", "appErrorCode":"3805", "message":"Bad Request", "details":"The Facebook Access Credentials are invalid. Received Facebook error response of type OAuthException: Error validating access token: This may be because the user logged out or may be due to a system error."}. But I already receive Facebook Access token. May I know what is the cause for this problem?
This error comes due to two cases check if the user is logged out or access token is expired when calling the method. Try to login to facebook and copy the new accesstoken. Let me know if it helps.
Hi, I try to login and use the new access token, but it comes out this exception:
Exception :: com.shephertz.app42.paas.sdk.csharp.App42NotFoundException: {"httpErrorCode":"404", "appErrorCode":"2402", "message":"Not Found", "details":"No message in the queue with  correlationId '201505041519317487118407' "}
Which method you are using can you share the code and full logs. For printing the logs in the editor write App42Log.SetDebug(true); in your start function.
Code used:
using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;    
using com.shephertz.app42.paas.sdk.csharp.social;  

public class Share_Button : MonoBehaviour {
   
    //public FB_HOLDER fb_share;
    string status="testing";

    static SocialService socialService = null;
   
    void Awake()
    {
        //fb_share = GameObject.Find ("FB").GetComponent<FB_HOLDER> ();
    }

    void Start()
    {
        socialService = App42API.BuildSocialService ();
        App42Log.SetDebug (true);
    }
   
    void OnClick ()
    {
        //fb_share.ShareWithFriends ();

        socialService.UpdateFacebookStatus(LeaderBoardCallBack.fbUserName, status, new ShareCallBack());   
    }
}
////////////////////////////////////////////////////////////////////////////////////
using System;
using com.shephertz.app42.paas.sdk.csharp.user;
using com.shephertz.app42.paas.sdk.csharp;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ShareCallBack : App42CallBack {

        public void OnSuccess(object response)  
        {  
            com.shephertz.app42.paas.sdk.csharp.social.Social socialObj = (com.shephertz.app42.paas.sdk.csharp.social.Social)response;
            Debug.Log("Social Response :: "+socialObj.ToString());
       
            String userName = socialObj.GetUserName();
            Debug.Log("Username: "+userName);      
            Debug.Log("Status: "+socialObj.GetStatus());      
        }  

        public void OnException(Exception e)  
        {  
            App42Log.Console("Exception : " + e);  
        }  
 
}
/////////////////////////////////////////////////////////////////////////////////////////////////
logs:

successValue : {"app42":{"response":{"success":true,"social":{"facebookAccessToken":"CAALI2GJVnB0BAKLcKOSZBpNHuOhw97LWnitfZA1RZC2JrQ0twYUwZBZAdnANIEl9vPTSwtcHSaImWesfxuRHZAkWYIUYe4xOVNuWiNp6dyWIFHlsFN4PLyhuA7RHZAgiZBCwJrtdFXdBktrhva7ZCqG610Pq93IQZCXIYwOmqcDZBb5RBwaJB483h8FvdaUXG2lipGduYAUHLVk21j24UM1KZCxb","me":{"id":"1032371100111243","name":"Taurus Hwq","picture":"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p50x50/10384022_1014299595251727_2033166682375938756_n.jpg?oh=73021d4bd433f40871a33fdc90f642dd&oe=55D3B10D&__gda__=1440840396_7e184ff18b0354bde22fc96be8bf036e","email":"wenqian_0430@hotmail.com"}}}}}
UnityEngine.Debug:Log(Object)
com.shephertz.app42.paas.sdk.csharp.App42Log:Console(String)
com.shephertz.app42.paas.sdk.csharp.connection.<execute>d__6:MoveNext()
com.shephertz.app42.paas.sdk.csharp.connection.<WaitForRequest>d__3:MoveNext()

Social :: {"app42":{"response":{"success":true,"social":{"facebookAccessToken":"CAALI2GJVnB0BAKLcKOSZBpNHuOhw97LWnitfZA1RZC2JrQ0twYUwZBZAdnANIEl9vPTSwtcHSaImWesfxuRHZAkWYIUYe4xOVNuWiNp6dyWIFHlsFN4PLyhuA7RHZAgiZBCwJrtdFXdBktrhva7ZCqG610Pq93IQZCXIYwOmqcDZBb5RBwaJB483h8FvdaUXG2lipGduYAUHLVk21j24UM1KZCxb","me":{"id":"1032371100111243","name":"Taurus Hwq","picture":"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p50x50/10384022_1014299595251727_2033166682375938756_n.jpg?oh=73021d4bd433f40871a33fdc90f642dd&oe=55D3B10D&__gda__=1440840396_7e184ff18b0354bde22fc96be8bf036e","email":"wenqian_0430@hotmail.com"}}}}}

 Json String : {"app42":{"social":{"userName":"Taurus Hwq","status":"testing"}}}

apiKeyd69e99dd7f2f86bb2a98cfa18b994748d48c5b33ceadcaa511e6696ed3fea5dbbody{"app42":{"social":{"userName":"Taurus Hwq","status":"testing"}}}timeStamp2015-05-04T08:04:34.890Zversion1.0

Exception : com.shephertz.app42.paas.sdk.csharp.App42BadParameterException: {"httpErrorCode":"400", "appErrorCode":"3805", "message":"Bad Request", "details":"The Facebook Access Credentials are invalid. Received Facebook error response of type OAuthException: Error validating access token: This may be because the user logged out or may be due to a system error."}
UnityEngine.D
These logs doesn't show everything, try copying from Editor Log. Right Click on the 'console' tab in your Unity Editor and click Open Editor Log. Share the logs here.
Hi, may I know how to share the logs here? Because maximum length is 8000 characters allow, so I cannot copy and paste the logs here. Thank you.
After I add, "App42API.Initialize("API key","Secret key"); " of facebook app in start function, there is another error occur.
[Exception : com.shephertz.app42.paas.sdk.csharp.App42SecurityException: {"httpErrorCode":"401", "appErrorCode":"1401", "message":"UnAuthorized Access", "details":"Client is not authorized"}]
The error message which you have shared occurs when your API/Secret Keys are not valid or your device time is incorrect while calling App42 API. Please make sure your credentials are valid and device time in which you are working is correct. If you still facing any issue then share your app logs with us at support@shephertz.com. It will help us to provide better support to you.

Thanks,
Himanshu Sharma
Hi, may I know how to make sure API/Secret Keys are valid or not and the device time is correct or not. Besides that, if I uncomment the "App42API.Initialize("API key","Secret key"), the error shown as below will occur.

Exception : com.shephertz.app42.paas.sdk.csharp.App42BadParameterException: {"httpErrorCode":"400", "appErrorCode":"3805", "message":"Bad Request", "details":"The Facebook Access Credentials are invalid. Received Facebook error response of type OAuthException: Error validating access token: This may be because the user logged out or may be due to a system error.
The exception 3805 occurs when your Facebook Access token is invalid, please make sure your Access token is valid while using social service. Also when you pass your APIKey and Secret key which you receive after the success of App Creation from AppHQ Management Console in "App42API.Initialize("API key","Secret key")" method, you  didn't encountered this issue "[Exception : com.shephertz.app42.paas.sdk.csharp.App42SecurityException: {"httpErrorCode":"401", "appErrorCode":"1401", "message":"UnAuthorized Access", "details":"Client is not authorized"}]". Please check and if you still having the issue then share your sample project source code with us at support@shephertz.com. It will help us to provide better support to you.

Thanks,
Himanshu Sharma
Hi, may I know is it because my access token expired? Because I try many method, still cannot solve this problem.
Hi, I am not sure that is because I create a "Link User Facebook Account"code, the exception,"[Exception : com.shephertz.app42.paas.sdk.csharp.App42SecurityException: {"httpErrorCode":"401", "appErrorCode":"1401", "message":"UnAuthorized Access", "details":"Client is not authorized"}]" not occur already, but "[Exception : com.shephertz.app42.paas.sdk.csharp.App42BadParameterException: {"httpErrorCode":"400", "appErrorCode":"3805", "message":"Bad Request", "details":"The Facebook Access Credentials are invalid. Received Facebook error response of type OAuthException: Error validating access token: This may be because the user logged out or may be due to a system error]" still exist.
Could you please share your sample project with us at support@shephertz.com? It will help us to provide better support to you.

Thanks,
Himanshu Sharma
(LinkFacebookUserToApp42)
using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;    
using com.shephertz.app42.paas.sdk.csharp.social;

public class LinkFBUsertoApp42 : MonoBehaviour {

    static SocialService socialService = null;

    void Start()
    {
        socialService = App42API.BuildSocialService ();
        App42Log.SetDebug (true);
    }

    // Update is called once per frame
    void Update () {

        if(LeaderBoardCallBack.isConnected)
        {
            Debug.Log("linked");
            socialService.LinkUserFacebookAccount(LeaderBoardCallBack.fbUserName, LeaderBoardCallBack.fbAccessToken, new LinkFBUserCallBack());
        }
   
    }
}

(LinkFacebookUserToApp42 callback)
using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;
using System;
using com.shephertz.app42.paas.sdk.csharp.game;

public class LinkFBUserCallBack : App42CallBack {

    public void OnSuccess(object response)  
    {  
        com.shephertz.app42.paas.sdk.csharp.social.Social socialObj = (com.shephertz.app42.paas.sdk.csharp.social.Social)response;

        String userName = socialObj.GetUserName();
        Debug.Log("Username: "+userName);      
        Debug.Log("Facebook access token(link): "+socialObj.GetFacebookAccessToken());  
    }  
    public void OnException(Exception e)  
    {  
        App42Log.Console("Exception : " + e);  
    }  
}

(Share button)
using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;    
using com.shephertz.app42.paas.sdk.csharp.social;  

public class Share_Button : MonoBehaviour {
   
    //public FB_HOLDER fb_share;
    string status="testing";
    static SocialService _socialService = null;
   
    void Awake()
    {
        //fb_share = GameObject.Find ("FB").GetComponent<FB_HOLDER> ();
    }

    void Start()
    {
        //App42API.Initialize("783781641690141","7d9cfdf8f47b1a4dfd5bcba60e51cf87");  
        _socialService = App42API.BuildSocialService ();
        App42Log.SetDebug (true);
    }
   
    void OnClick ()
    {
        //fb_share.ShareWithFriends ();
        _socialService.UpdateFacebookStatus(LeaderBoardCallBack.fbUserName, status, new ShareCallBack());   
    }
}

(ShareCallBack)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using com.shephertz.app42.paas.sdk.csharp;
using System;
using com.shephertz.app42.paas.sdk.csharp.game;
using com.shephertz.app42.paas.sdk.csharp.storage;
using com.shephertz.app42.paas.sdk.csharp.social;

public class ShareCallBack : App42CallBack {

        public void OnSuccess(object response)  
        {  
            com.shephertz.app42.paas.sdk.csharp.social.Social socialObj = (com.shephertz.app42.paas.sdk.csharp.social.Social)response;
            Debug.Log("Social Response :: "+socialObj.ToString());
       
            String userName = socialObj.GetUserName();
            Debug.Log("Username: "+userName);      
            Debug.Log("Status: "+socialObj.GetStatus());      
        }  

        public void OnException(Exception e)  
        {  
            App42Log.Console("Exception : " + e);  
        }  
 
}
(AppConstants)
using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;
using com.shephertz.app42.paas.sdk.csharp.game;
using com.shephertz.app42.paas.sdk.csharp.social;
using com.shephertz.app42.paas.sdk.csharp.storage;

public class AppConstants : MonoBehaviour {

    public static string API_KEY = "API_KEY";
    public static string SECRET_KEY = "SECRET_KEY";
    public static string gameName = "gameName";
    public static string collectionName = "collectionName";
    public static string DB_NAME = "DB_NAME";
    public static string FB_APP_ID = "FB_APP_ID";


    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {
   
    }

    public static ScoreBoardService GetScoreService()
    {
        ScoreBoardService scoreboardService = App42API.BuildScoreBoardService ();
        return scoreboardService;
    }

    public static SocialService GetSocialService()
    {
        SocialService socialService = App42API.BuildSocialService ();
        return socialService;
    }
}

(AppController)
using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;
using com.shephertz.app42.paas.sdk.csharp.social;
using System.Net;

public class AppController : MonoBehaviour {
    public bool isConnected = false;
    #if UNITY_EDITOR
    public static bool Validator (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
    {return true;}
    #endif
    void Start ()
    {
        #if UNITY_EDITOR
        ServicePointManager.ServerCertificateValidationCallback = Validator;
        #endif
        App42API.Initialize (AppConstants.API_KEY,AppConstants.SECRET_KEY);
        App42API.EnableCrashEventHandler (false);
        App42Log.SetDebug (true);
        App42API.SetDbName (AppConstants.DB_NAME);
    }
   
    // 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 ());
        }
    }
}

(FacebookService)
using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp.social;
using com.shephertz.app42.paas.sdk.csharp;

public class FacebookService{

    static SocialService socialService = null;

    public static string fbAccessToken = "";

    public static void ConnectWithFacebook(){
        socialService = App42API.BuildSocialService ();
        // Making facebook Permissions Array.
        string[] perms = new string[10];
        perms [0] = FBPerms.email;       
        perms [1] = FBPerms.user_friends;
        socialService.DoFBOAuthAndGetToken (AppConstants.FB_APP_ID, perms, false, new LeaderBoardCallBack ());
    }
}

(LeaderBoardCallBack)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using com.shephertz.app42.paas.sdk.csharp;
using System;
using com.shephertz.app42.paas.sdk.csharp.game;
using com.shephertz.app42.paas.sdk.csharp.storage;
using com.shephertz.app42.paas.sdk.csharp.social;

public class LeaderBoardCallBack : App42CallBack {

    public static string fbUserName = "";
    public static string fbUserProfilePic = "";
    public static string fbUserId = "";
    public static bool isConnected = false;

    public static bool fromSaveScore = false;
    public static bool fromLeaderBoard = false;


    public static Dictionary<string,object> metaInfo = new Dictionary<string,object>();
    public static Dictionary<string,object> nameAndPP = new Dictionary<string,object>();

    //StorageService storageService = App42API.BuildStorageService();
    //static StorageService storageService = null;

    public static IList<object> fList = new List<object> ();

    AppController fbUserCon = new AppController ();

    public static string fbAccessToken = "";

    public void OnSuccess (object response)
    {
        if (response is string){
            //LoadingMessage.newMessage  = "SuccessFully Connected With Facebook";
            Debug.Log("SuccessFully Connected With Facebook");
            LeaderBoardCallBack.fbAccessToken = response.ToString();
            LeaderBoardCallBack.isConnected = true;
            //Application.LoadLevel("GameScene");
        }

        if (response is Game){
            Game gameObj = (Game)response;
            Debug.Log("Game ::: "+gameObj.ToString());
            if (fromLeaderBoard){//display only after user click on "Global Leaderboard" on main menu
                if(gameObj.GetScoreList().Count > 0){
                    for (int i=0; i<gameObj.GetScoreList().Count; i++){
                        int currentDetails = gameObj.GetScoreList()[i].GetJsonDocList().Count-1;
                        string score = gameObj.GetScoreList()[i].GetValue().ToString();
                        string jsonDoc = gameObj.GetScoreList()[i].GetJsonDocList()[currentDetails].GetJsonDoc();
                        //storageService.InsertJSONDocument(AppConstants.DB_NAME, AppConstants.collectionName, jsonDoc,new JSONCallBack());   
                        var parser = SimpleJSON.JObject.Parse(jsonDoc);
                        string profilePic = parser["profilePic"];
                        string userId = parser["userId"];
                        string name =  parser["name"];
                        Texture_App42.GetInstance().ExecuteShow(userId, profilePic);
                       
                        Debug.Log("userId ::: " + name);
                       
                        IList<string> slist1 = new List<string>();
                        slist1.Add(userId);
                        slist1.Add(name);
                        slist1.Add(profilePic);
                        slist1.Add(score);
                        fList.Add(slist1);
                    }
                }
                fromLeaderBoard = false;
//                Application.LoadLevel("leaderBoard");
            }
            if (fromSaveScore){
//                LoadingMessage.SetMessage("Score SuccessFully Saved.");
                //fromSaveScore = false;
                if(gameObj.GetScoreList().Count > 0){
                    for (int i=0; i<gameObj.GetScoreList().Count; i++){
                        int currentDetails = gameObj.GetScoreList()[i].GetJsonDocList().Count-1;
                        string score = gameObj.GetScoreList()[i].GetValue().ToString();
                        string jsonDoc = gameObj.GetScoreList()[i].GetJsonDocList()[currentDetails].GetJsonDoc();
                        //storageService.InsertJSONDocument(AppConstants.DB_NAME, AppConstants.collectionName, jsonDoc,new JSONCallBack());   
                        var parser = SimpleJSON.JObject.Parse(jsonDoc);
                        string profilePic = parser["profilePic"];
                        string userId = parser["userId"];
                        string name =  parser["name"];
                        Texture_App42.GetInstance().ExecuteShow(userId, profilePic);
                       
                        Debug.Log("userId ::: " + name);
                       
                        IList<string> slist1 = new List<string>();
                        slist1.Add(userId);
                        slist1.Add(name);
                        slist1.Add(profilePic);
                        slist1.Add(score);
                        fList.Add(slist1);
                    }
                }
                fromSaveScore = false;
            }

        }
        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();
        //    FBUserConnect.isConnected = false;
        }
    }

   
    public void OnException (Exception e)
    {
        Debug.Log("Exception :: "+e.ToString());
    }


    public static IList<object> GetList(){
        return fList;
    }

//    public void FetchFBUserDetails(){
//        foreach(KeyValuePair<string,object> pair in metaInfo){
//
//        }
//    }

}
Hi, codes above are used to connect with facebook and social service of APP42. Thank you.
0 votes
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.
}
answered May 9, 2015 by Akshay.Mishra (179 points)
Hi, very thank you for your help. The user is successfully linked to App42, but after I pressed on "Update Facebook Status", the exception below will occur,

[Exception : com.shephertz.app42.paas.sdk.csharp.App42BadParameterException: {"httpErrorCode":"400", "appErrorCode":"3805", "message":"Bad Request", "details":"The Facebook Access Credentials are invalid. Received Facebook error response of type OAuthException: (#200) The user hasn't authorized the application to perform this action"}] . May I know what is cause of this problem? Because I have linked the user to App42 cloud. Thank you.
Now you just have to add permission to your app for updating facebook status.
Add permission "publish_actions" before DoFBOAuthAndGetToken method call in your FacebookService class Like :

// Making facebook Permissions Array.
        string[] perms = new string[10];
        perms [0] = FBPerms.email;        
        perms [1] = FBPerms.user_friends;
        perms [2] = "publish_actions"; // new permission added.
        socialService.DoFBOAuthAndGetToken (AppConstants.FB_APP_ID, perms, false, new LeaderBoardCallBack ());

for other permissions check https://developers.facebook.com/docs/reference/fql/permissions

Let us know if it works for you.

Thanks,
Akshay Mishra
Hi,thank you again for your reply. It's worked for me. If I want to type the status by myself, is it possible? Because after I integrate with App42, I cannot share and invite by using Facebook SDK. The code below is used to share and invite from Facebook SDK that cannot work after I integrate with App42:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class FB_HOLDER : MonoBehaviour {
    public GameObject UIFBIsLoggedIn;
    public GameObject UIFBNotLoggedIn;
    public GameObject UIFBAvatar;
    public GameObject UIFBUserName;

    private Dictionary<string,string> profile=null;

    void Awake()
    {
        FB.Init (SetInit, OnHideUnity);
    }

    private void SetInit()
    {
        Debug.Log ("FB Init done.");

        if(FB.IsLoggedIn)
        {
            Debug.Log("FB Logged In");
            DealWithFBMenu(true);
        }

        else
        {
            DealWithFBMenu(false);
        }
    }

    private void OnHideUnity(bool isGameShown)
    {
        if(isGameShown)
        {
            Time.timeScale=0;
        }
        else
        {
            Time.timeScale=1;
        }
    }

    public void FBlogin()
    {
        FB.Login ("email", AuthCallback);
    }

    void AuthCallback(FBResult result)
    {
        Debug.Log("sss");
        if(FB.IsLoggedIn)
        {
            Debug.Log("FB login worked");
            DealWithFBMenu(true);
        }
        else
        {
            Debug.Log("FB login fail");
            DealWithFBMenu(false);
        }
    }

    void DealWithFBMenu(bool isLoggedIn)
    {
        if(isLoggedIn)
        {
            UIFBIsLoggedIn.SetActive(true);
            UIFBNotLoggedIn.SetActive(false);

            //get profile picture code
//            FB.API(Util.GetPictureURL("me",128,128),Facebook.HttpMethod.GET,DealWithProfilePicture);
            //get username code
            FB.API("/me?fields=id,first_name",Facebook.HttpMethod.GET,DealWithUserName);
        }
        else
        {
            UIFBIsLoggedIn.SetActive(false);
            UIFBNotLoggedIn.SetActive(true);
        }
    }
   
//    void DealWithProfilePicture(FBResult result)
//    {
//        if(result.Error!=null)
//        {
//            Debug.Log("Getting problem with profile picture");
//            FB.API(Util.GetPictureURL("me",128,128),Facebook.HttpMethod.GET,DealWithProfilePicture);
//            return;
//        }
//        UISprite userAvatar = UIFBAvatar.GetComponent<UISprite> ();
//        userAvatar.material = Sprite.Create (result.Texture, new Rect (0, 0, 128, 128), new Vector2 (0, 0));
//    }

        void DealWithUserName(FBResult result)
        {
            if(result.Error!=null)
            {
                Debug.Log("Getting problem with profile picture");
                FB.API(Util.GetPictureURL("me",128,128),Facebook.HttpMethod.GET,DealWithUserName);
                return;
            }

        profile = Util.DeserializeJSONProfile (result.Text);
        UILabel userMsg = UIFBUserName.GetComponent<UILabel> ();
        userMsg.text = "Hello, ".ToString () + profile ["first_name"].ToString ();
           
        }

    public void ShareWithFriends()
    {
        FB.Feed
            (
                linkCaption: "I'm testing!!",
                linkName: "Check out prototype"
                );
    }

    public void InviteFriends()
    {
        FB.AppRequest
            (
                message: "Testing",
                title: "Invite friends"
                );
    }

   
}
Hello,

Great to hear that you previous query has been resolved. Please make sure you have followed all the steps mention in the Facebook SDK. Because we do not restrict any of our customers to use other party library.

Regards,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...