Get Facebook friends at an event?

How can I see which of my friends are attending a Facebook event? I can get a list of all members using the Facebook SDK using GraphPath: @ "eventId / attendending /".

Is it possible that I want to use the Graph API? I read a few answers on how to achieve this using FQL, but I don’t know how to implement it in iOS. The only option I came across was to gather all the friends and all the participants and cross-reference them against each other, but this is very inconvenient.

So, how do I get only friends from Facebook to Facebook?

+4
source share
4 answers

Ok, so I found a solution to my problem ... The only way to achieve what I want is through FQL. Basically, these are cross-references of your friends with participants, but on Facebook servers, and you only get the data that you request (in my case, user ID, name, image). I did not understand how to set the limit and offset, but I do not require this, and I think it is possible through FQL ...

Here is my code:

-(void)getFriendsAttending{ NSLog(@"getting friends"); NSString *fql = [NSString stringWithFormat:@"SELECT uid, name, pic FROM user WHERE uid IN (SELECT uid FROM event_member WHERE eid = %@ AND rsvp_status = 'attending' AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()))", fbID]; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:fql forKey:@"q"]; [FBRequestConnection startWithGraphPath:@"/fql" parameters:params HTTPMethod:@"GET" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if (error) { NSLog(@"Error: %@", [error localizedDescription]); } else { NSLog(@"Friends at event %@: %@", fbID, result); } }]; } 

And here is a clean FQL query for clarity (123456789 is the event identifier):

 SELECT uid, name, pic FROM user WHERE uid IN (SELECT uid FROM event_member WHERE eid = 123456789 AND rsvp_status = 'attending' AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())) 
+1
source

This is from a tutorial provided by Facebook.

You can check whether a specific user answered β€œyes” to the HTTP GET event on / EVENT_ID / visit / USER_ID. These operations require the permission of user_events or friends_events for non-public events and return an array of objects with the name id and rsvp_status. When checking one user, empty data will be returned if the user did not answer β€œyes” to the event.

You can verify this by checking the event category at this link:

http://developers.facebook.com/docs/reference/api/event/

Use / EVENT_ID / attending / USER_ID to find out which friend is attending an event

+2
source

Just use {event id} / attending, and then filter it based on your actual friends list.

0
source

Using FQL Query try:

 SELECT uid FROM event_member WHERE eid = YOU_EVENT_ID_HERE AND rsvp_status = 'attending' 

Using the Graph API:

 /YOU_EVENT_ID_HERE/attending 

This returns the visited friends user id (uid).

ASH

0
source

Source: https://habr.com/ru/post/1479913/


All Articles