【发布时间】:2017-08-10 19:34:46
【问题描述】:
我在 Unity 3D 上获取 facebook 名称时出错,这个功能在 2 周前就可以正常工作了,
FB.Init(this.InitCallback, this.OnHideUnity);
private void InitCallback ()
{
if (FB.IsInitialized) {
if (FB.IsLoggedIn) {
FB.LogInWithReadPermissions(new List<string>() { "public_profile","email" }, this.AuthCallback);
} else {
}
} else {
Debug.Log("Failed to Initialize the Facebook SDK");
}
}
private void AuthCallback (ILoginResult result) {
if (FB.IsLoggedIn) {
FB.API("/me?fields=name", HttpMethod.GET, this.LoginCallback2);
} else {
//Debug.Log("User cancelled login");
}
}
void LoginCallback2(IResult result)
{
if (result.Error != null) {
Debug.Log(result.Error);
}
else{
fbid = result.ResultDictionary ["id"].ToString();
}
}
LoginCallback2 函数出错,调试如下:
UnityEngine.Debug:Log(Object)
connect:LoginCallback2(IResult) (at Assets/connect.cs:983)
Facebook.Unity.<Start>d__9:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
【问题讨论】:
标签: unity3d facebook-unity-sdk