用于获取用户 Facebook 好友性别以及 meet_sex 的 FQL 查询

发布于 2024-12-22 07:26:26 字数 1168 浏览 3 评论 0 原文

并不像听起来那么活泼 - 我使用下面的代码来仅获取用户的男性或女性朋友,并且效果很好。但是,我还想检查他们的“meeting_sex”,这是用户朋友有兴趣见面的性别列表,即男性、女性或两者兼而有之。 (此处进行了描述)

meeting_sex需要我已添加到的friends_relationship_details权限图形 API 资源管理器,但我的输出如下所示:

"data": [
{
  "name": "ABCDEF", 
  "pic_square": "https://abcdefg.jpg", 
  "sex": "male", 
  "meeting_sex": null, 
  "uid": 123456789
}, 

即,meeting_sex 返回 null。我知道 Meeting_sex 是一个数组,而不仅仅是一个字符串,其他元素也是如此,但为什么它返回 null?

我是 FQL 的新手,实际上是任何 QL 的新手,所以一旦我正确读取数组,我该如何进行比较?也就是说,我只返回喜欢女性的男性或喜欢男性的男性等。这是我当前的代码:

NSString *queryString =  [NSString stringWithFormat:@"SELECT name, pic_square, sex, meeting_sex, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND sex = 'male' ORDER BY name"];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys: queryString, @"query", nil];

[FBRequest getRequestWithParams:dictionary
                     httpMethod:@"GET" 
                       delegate:self
                     requestURL:@"fql.query"];

感谢您的帮助:)

Michael

Not quite as racy as it sounds - I'm using the below code to get a user's male or female friends only and it works fine. However, I also want to check their 'meeting_sex' which is a list of the genders a user's friend is interested in meeting, i.e. male, female or both. (Described here)

The meeting_sex requires the friends_relationship_details permission which I've added to the graph API explorer, but my output looks like this:

"data": [
{
  "name": "ABCDEF", 
  "pic_square": "https://abcdefg.jpg", 
  "sex": "male", 
  "meeting_sex": null, 
  "uid": 123456789
}, 

I.e. the meeting_sex is coming back null. I know the meeting_sex is an array, not just a string, as are the other elements, but why is it coming back null?

I'm new to FQL, and in fact any QL, so once I do get the array to read properly, how do I then make the comparison? i.e so I only return MEN who like WOMEN or MEN who like MEN etc. Here's my current code:

NSString *queryString =  [NSString stringWithFormat:@"SELECT name, pic_square, sex, meeting_sex, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND sex = 'male' ORDER BY name"];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys: queryString, @"query", nil];

[FBRequest getRequestWithParams:dictionary
                     httpMethod:@"GET" 
                       delegate:self
                     requestURL:@"fql.query"];

Thanks for any help :)

Michael

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

咋地 2024-12-29 07:26:26

我已经在我的帐户上尝试过此操作,除了我的一位朋友之外,所有其他帐户都为空。他们对 Meeting_for 和 Meeting_sex 都有一个空数组,

我发现有些人建议不再使用此数组:

http://forum.developers.facebook.net/viewtopic.php?id=103173

此外,似乎存在很多隐私问题:

请参阅https://www.facebook.com/settings/?tab=privacy 点击“应用程序和网站”然后“人们如何将您的信息带到他们使用的应用程序中”

也来自 https://developers.facebook.com/docs/reference/rest/users.getInfo/

User Privacy and Visible Data

Important: Depending upon the user's privacy settings (including whether the user has decided to opt out of Platform completely), you may not see certain user data. For any user submitted to this method, the following user fields are visible to an application only if that user has authorized that application and specifically chose to reveal them:

    meeting_for
    meeting_sex
    religion

编辑

Graph API 用户中的新增内容 (https://developers .facebook.com/docs/reference/api/user/) 对象:

感兴趣
用户感兴趣的性别。user_relationship_detailsfriends_relationship_details。包含字符串的数组

I've tried this on my account and I get nulls for all but one of my friends. They have an empty array for both the meeting_for and meeting_sex

I've found that some have suggested this is no longer being used:

http://forum.developers.facebook.net/viewtopic.php?id=103173

Also, it seems there's a lot of privacy concerns around this:

See https://www.facebook.com/settings/?tab=privacy Click "Apps and Websites" then "How people bring your info to apps they use"

Also From https://developers.facebook.com/docs/reference/rest/users.getInfo/

User Privacy and Visible Data

Important: Depending upon the user's privacy settings (including whether the user has decided to opt out of Platform completely), you may not see certain user data. For any user submitted to this method, the following user fields are visible to an application only if that user has authorized that application and specifically chose to reveal them:

    meeting_for
    meeting_sex
    religion

EDIT

New in the Graph API's user (https://developers.facebook.com/docs/reference/api/user/) object:

interested_in
The genders the user is interested in. user_relationship_details or friends_relationship_details. array containing strings.

泪是无色的血 2024-12-29 07:26:26

该文档说需要 user_relashionship_details friends_relationship_details。我认为您需要添加 user_relashionship_details 来获取有关用户本身的详细信息,而不仅仅是他们的朋友。

The doc says is requires user_relashionship_details or friends_relationship_details. I think it would follow that you need to add user_relashionship_details to get this detail about the user itself, not just their friends.

迷鸟归林 2024-12-29 07:26:26

对我来说,我能够从 json 属性获取“meeting_sex”所需的数据:
“性别”:“男”,
"interested_in": ["female"]

希望这有帮助。

For me i was able to get the data i wanted for "meeting_sex" from the json attribute:
"gender": "male",
"interested_in": ["female"]

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文