2

As facebook just released it's new sdk for Unity. I m trying to use FB.API method and getting a lot of troubles with it. Like this is code I have written in UnityScript in my Unity project.

function LoginCallback() {
    Debug.Log("User id is"+ FB.UserId);
    FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, LogCallback, null);
    FBUtil.Log(FB.UserId); // Use this to sync progress, etc.
}

function LogCallback(response:String) {
//    Debug.Log(response);
    var profile = FBUtil.DeserializeJSONProfile(response);
    var friends = FBUtil.DeserializeJSONFriends(response);
}

I am getting this error in Unity Log BCE0005: Unknown identifier: 'FBUtil'. And if I comment out the FBUtil part and just try to print the json string by writing this

function LoginCallback() {
    Debug.Log("User id is"+ FB.UserId);
    FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, LogCallback, null);

}

function LogCallback(response:String) {
    Debug.Log(response);
        }

I am able to get Fb.UserId but I am not getting the response with the following details like first_name, friends. The error in DDMS Log is this

"09-04 21:35:04.534: E/Unity(23893): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54) "

Someone help me out.

4

0 回答 0