FB.API请求无法在iOS

时间:2016-01-22 17:09:55

标签: ios facebook-graph-api unity3d facebook-unity-sdk

我正在使用 Unity3D v5.3.1f1 适用于Unity v7.2.0的Facebook SDK 为Android + iOS开发游戏。游戏中有排行榜,显示在Facebook上保存的分数,还有个人资料图片。

代码实现如下:

// Generate Graph API query for a user/friend's profile picture
public static string GetPictureQuery(string facebookID, int? width = null, int? height = null, string type = null, bool onlyURL = false)
{
    string query = string.Format("/{0}/picture", facebookID);
    string param = width != null ? "&width=" + width.ToString() : "";
    param += height != null ? "&height=" + height.ToString() : "";
    param += type != null ? "&type=" + type : "";
    if (onlyURL) param += "&redirect=false";
    if (param != "") query += ("?g" + param);
    return query;
}

string ids = "friend id here";
void loadFBProfilePicture()
{
     string query = GraphUtil.GetPictureQuery(ids, 100, 100, "normal");
     FB.API(query, HttpMethod.GET, dealWithProfPic);
}

void dealWithProfPic(IGraphResult result)
{
    Debug.Log("Callback called!");
    if (result.Error != null)
    {
        return;
    }
    profpic.sprite = Sprite.Create(result.Texture, new Rect(0, 0, 100, 100), new Vector2(0, 0));
}

程序只需要调用loadFBProfilePicture函数,然后回调函数dealWithProfPic将纹理分配给精灵。这在Android和Android上完美运行Unity Editor,但不适用于iOS!
经过一些调试,我发现的问题是,从不调用回调。记录消息"回调叫"永远不会出现在调试窗口上。
已经尝试的解决方案是将Facebook SDK for Unity升级到v7.3.0,但仍然没有结果。

其他信息:在带有iOS 9.2的Ipad Air 2上进行测试

编辑(2016年1月25日): Facebook已经确认这是link

的错误

0 个答案:

没有答案