0

我需要从 unity3d 向 Facebook 发送一个 GET 请求并检索它的答案(JSON 对象)。我在带有 WebRequest 的 Visual Studio 中做得很好。但据我所知,iOS 不支持 WebRequest 类。所以我试图用 Unity 的标准 WWW 类来实现这一点。执行以下操作:

public static IEnumerator GETRequestToFacebook()
{
    WWW www = new WWW("https://graph.facebook.com/fql?q=select name from profile where id=707855857");

    yield return www;

    Debug.Log(www.text);
}

但是该方法给了我以下错误:“您正在尝试从 www 流中加载数据,下载时出现以下错误。400 Bad Request”。但是,如果我将 url 更改为“http://www.google.com”,它就可以正常工作。

我应该怎么做才能使我的初始 GET 请求在 unity3d 中工作?

谢谢!

4

1 回答 1

2

解决了。我应该在 FQL 请求中添加“+”号。

https://graph.facebook.com/fql?q=select+name+from+profile+where+id=707855857 "

没关系,我已经写了一个网络套接字。

于 2012-07-20T22:59:05.467 回答