简体   繁体   English

如何使用Facebook Unity插件v6.2.2检索国家

[英]How do I retrieve country using Facebook Unity Plugins v6.2.2

Environment: 环境:

  • Facebook Unity Plugins v6.2.2 Facebook Unity插件v6.2.2
  • Unity 4.6.8 p1 Unity 4.6.8 p1
  • GraphAPI 2.4 图形API 2.4

Problem 问题

Using Unity with the above SDK Plugin installed, I enter the following: 在安装了上述SDK插件的情况下使用Unity,我输入以下内容:

(public_profile,user_friend,user_location,_user_hometown)

However the return does not include the hometown. 但是,返回不包括故乡。 How can I make it so it returns the correct value? 我怎样才能使它返回正确的值?

I have tried the codes on the following page, but was unsuccessful: How to retrieve user country using facebook Graph API? 我已经尝试了下一页上的代码,但未成功: 如何使用facebook Graph API检索用户国家/地区?

Thanks 谢谢

FYI, The above command works fine if I use the GraphAPI explorer 仅供参考,如果我使用GraphAPI资源管理器,则上述命令可以正常运行

Has your app passed the login review process for the extended permissions user_location and user_hometown ? 您的应用是否通过了扩展权限user_locationuser_hometown的登录审核过程?

See 看到

After

FB.Init(OnInitComplete, OnHideUnity);

and

FB.Login("'permissions'", LoginCallback);

things (by the way you don't need any extra permissions to get country) this code will give you country 事情(顺便说一句,您不需要任何额外的权限来获取国家/地区),此代码将为您提供国家/地区

void Get()
{
    FB.API("me", Facebook.HttpMethod.GET, UserCallBack);
}

void UserCallBack(FBResult result)
{
    if (result.Error != null)
    {
        Debug.Log("FB.API result = null");
    }
    else
    {
        var dict = Facebook.MiniJSON.Json.Deserialize(result.Text) as IDictionary;
        country = dict["locale"].ToString();
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM