我使用以下代码从Facebook获取用户数据
IEnumerator UserFBDataGet(string accessTkn)
{
var downloader3 = new WWW ( "https://graph.facebook.com/me?fields=id,name,email&access_token="+accessTkn );
//Application.OpenURL ( "https://graph.facebook.com/me?fields=id,name,email&access_token="+accessTkn );
yield return downloader3;
print(" downloader3.text ="+downloader3.text );
if(downloader3.error == null)
{
print(" downloader3.text ="+downloader3.text );
}
else
{
print(" downloader3.error ="+downloader3.error );
}
}
显示错误
您正在尝试从www流加载数据,下载时出现以下错误。 400错误请求 UnityEngine.WWW:get_text() c__Iterator1:MoveNext()(在Assets / FBDesktopManager.cs:126)
即使我使用WWWForm同样的错误显示
IEnumerator UserFBDataGet(string accessTkn)
{
userDataGetUrl = "https://graph.facebook.com/me?";
WWWForm wf = new WWWForm();
wf.AddField ("fields","id,name,email") ;
wf.AddField ("access_token",accessTkn) ;
WWW downloader3 = new WWW(userDataGetUrl,wf) ;
yield return downloader3;
print(" downloader3.text ="+downloader3.text );
if(downloader3.error == null)
{
print(" downloader3.text ="+downloader3.text );
}
else
{
print(" downloader3.error ="+downloader3.error );
}
}
但是当我打电话时
Application.OpenURL ( "https://graph.facebook.com/me?fields=id,name,email&access_token="+accessTkn );
在该页面中,我可以正确获取所有数据。