Facebook:获取用户的语言环境
Facebook: obtain user's locale
在使用 FB JS SDK 的 Facebook 网络游戏中,如何获取用户的语言环境,即用户更喜欢用什么来渲染游戏?
尝试了这些,但 none 有效:
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 根本没有 user 字段
locale
不再可用,请参阅 https://developers.facebook.com/docs/graph-api/changelog/version3.0/#gapi-change:
The following default fields have replaced public_profile: […]
As a result, the following fields that belonged to public_profile are deprecated:
- […]
- locale
- […]
.
where response.authResponse doesn't have user field at all
也不应该了,你只会得到一个userID
,见https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus#response_and_session_objects
在使用 FB JS SDK 的 Facebook 网络游戏中,如何获取用户的语言环境,即用户更喜欢用什么来渲染游戏?
尝试了这些,但 none 有效:
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 根本没有 user 字段
locale
不再可用,请参阅 https://developers.facebook.com/docs/graph-api/changelog/version3.0/#gapi-change:
The following default fields have replaced public_profile: […]
As a result, the following fields that belonged to public_profile are deprecated:
- […]
- locale
- […]
.
where response.authResponse doesn't have user field at all
也不应该了,你只会得到一个userID
,见https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus#response_and_session_objects