在带有FB JS SDK 的Facebook Web Games 中,如何获取用户的语言环境,即用户喜欢用语言来渲染游戏?
尝试了这些,但没有一个奏效:
FB.api(
'/me',
{ fields: 'id,name,first_name,last_name,locale,picture'},
r => console.log( 'FB /me:', r ),
)
打印除区域设置之外的所有内容。和:
FB.login( response => console.log( 'locale:', response.authResponse.user.locale ) )
其中response.authResponse根本没有用户字段
locale
不再可用,请参阅https://developers.facebook.com/docs/graph-api/changelog/version3.0/#gapi-change:
以下默认字段已替换 public_profile:[…]
因此,不推荐使用以下属于 public_profile 的字段:
- [...]
- 区域设置
- [...]
.
其中 response.authResponse 根本没有用户字段
也不应该再有,你只会得到一个userID
,见https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus#response_and_session_objects
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句