[英]Facebook FQL: uid of friends
I'm using restfb 1.6.5 (the same problem in 1.6.4) and have problems getting the uids of my friends.我正在使用 restfb 1.6.5(1.6.4 中的相同问题)并且在获取我朋友的 uid 时遇到问题。 This works fine (me-query):
这很好用(我的查询):
User fbUserMe = fbClient.fetchObject("me", com.restfb.types.User.class);
logger.debug(fbUserMe.getId());
The response body contains something like: {"id":"1234","name":"ME"...}
and fbUserMe.getId()
returns my uid.响应正文包含如下内容:
{"id":"1234","name":"ME"...}
并且fbUserMe.getId()
返回我的 uid。 With the next code snipped I want to get the uids of my friends (friends-query):随着下一个代码被剪断,我想得到我朋友的 uid(朋友查询):
StringBuffer sb = new StringBuffer();
sb.append("SELECT uid, first_name, last_name FROM user");
sb.append(" WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())");
List<User> users = fbClient.executeQuery(sb.toString(), User.class);
for(User fbUser : users)
{
logger.debug(fbUser.getId());
}
But this always outputs null
, although the response body contains this: [{"uid":5678,"first_name":"Peter"...}...]
.但这总是输出
null
,尽管响应正文包含: [{"uid":5678,"first_name":"Peter"...}...]
。
The obvious difference in the response by is id=1234
for the me-query and uid=5678
for the friends-query.响应中的明显区别是我查询的
id=1234
和朋友查询的uid=5678
。 If I use a custom class FqlUser
like described in RestFB I'm able to get the uid .如果我使用自定义 class
FqlUser
,如RestFB中所述,我可以获得uid 。 Now I'm uncertain of the uid .现在我不确定uid 。 Do I really get same same id (the same my friend would get in a me-Query) or do I get something like the third_party_id described in Facebook: FQL-user ?
我真的得到相同的id (我的朋友在我的查询中会得到相同的 id)还是得到类似于Facebook: FQL-user中描述的third_party_id的东西?
You're getting the uid.你得到了uid。 The same id your friend would get in a "me query".
您的朋友会在“我的查询”中获得相同的 ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.