问题
Environment:
- Facebook Unity Plugins v6.2.2
- Unity 4.6.8 p1
- GraphAPI 2.4
Problem
Using Unity with the above SDK Plugin installed, I enter the following:
(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?
Thanks
FYI, The above command works fine if I use the GraphAPI explorer
回答1:
Has your app passed the login review process for the extended permissions user_location
and user_hometown
?
See
- https://developers.facebook.com/docs/facebook-login/review/what-is-login-review
- https://developers.facebook.com/docs/facebook-login/best-practices#loginreview
回答2:
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();
}
}
来源:https://stackoverflow.com/questions/32450576/how-do-i-retrieve-country-using-facebook-unity-plugins-v6-2-2