根据Facebook文档,age_range是请求用户数据时的默认属性:https: //developers.facebook.com/docs/facebook-login/permissions#reference-basic-info
当我使用" me "作为具有正确令牌的用户ID 时,这确实有效:
https://graph.facebook.com/me?fields=id%2Cname%2Cemail%2Cfirst_name%2Clast_name%2Cusername%2Cgender%2Cpicture%2Cage_range&format=json&access_token=[accessToken for required user]
{
"id": "FACEBOOKID",
"name": "testuser",
"email": "testuser\u0040test.net",
"first_name": "testuser",
"last_name": "testuser",
"gender": "male",
"age_range": {
"min": 21
},
"picture": {
"data": {
"url": "https://...",
"is_silhouette": false
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用用户ID时,data_range为空:
给我回复:
{
"id": "FACEBOOKID",
"name": "testuser",
"email": "testuser\u0040test.net",
"first_name": "tftestuser",
"last_name": "tftestuser",
"gender": "male",
"picture": {
"data": {
"url": "http://....",
"is_silhouette": true
}
}
}
Run Code Online (Sandbox Code Playgroud)
知道为什么吗?我在这里错过了什么?
先感谢您!
我想解决以下问题:
我有一个未来[地图[A,B]].对于所有B,我需要应用一个将B转换为Future [C]的方法,并且我想要回馈Future [Map [A,C]]
这是我到目前为止的代码:
def getClients(clientIds: Seq[Int]): Future[Map[Int, ClientData]] = {
def getClientData(clientInfo: ClientInfo): Future[ClientData] =
clientInfo match {
case ValidInfo(info) => getData(info)
case _ => throw new Exception
}
client.getClients(clientIds) map {
_.toMap map {
case (clientId: Int, clientInfo: ClientInfo) =>
getClientData(clientInfo) map {
clientData => (clientId, clientData)
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
此代码错误,因为它返回Iterable [Future [(Int,ClientData)]]
对于info getClients是一个thrift方法,它返回Map [Map [A,B]],其中Map是可变的,所以我需要首先使用toMap将它转换为不可变的映射.
预先感谢您的帮助!