Facebook的sdk for Unity:错误

时间:2013-09-04 16:07:36

标签: unityscript facebook-unity-sdk

Facebook刚刚发布了Unity的新版本。我试图使用FB.API方法并且遇到很多麻烦。这就是我在Unity项目中用UnityScript编写的代码。

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);
}

我在Unity Log中收到此错误  BCE0005:未知标识符:'FBUtil'。 如果我注释掉FBUtil部分并尝试通过编写

来打印json字符串
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);
        }

我能够获得Fb.UserId,但我没有收到像first_name,friends这样的详细信息的回复。 DDMS日志中的错误是这个

“09-04 21:35:04.534:E / Unity(23893):(文件名:./ Runtime / ExportGenerated/AndroidManaged/UnityEngineDebug.cpp行:54) “

有人帮助我。

0 个答案:

没有答案