Alex Rivera | Logout

How to find Facebook Friends using the same app

Asked 2011-12-12T13:35:07.983
12

I am creating an app and would like people using the app to find friends using the same app on Facebook. Any help on this would be great.

I know this can be done. I have seen it on Instagram and Tiger Woods 12.

Edit
Report

2 Answers

4

I have solved this problem in very easy way

Step 1= first download FbGraph API

Step 2= use this code for authentication

NSString *client_id = @"XXXXXXXXXXXXXX";// App id

//alloc and initalize our FbGraph instance
self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];

//begin the authentication process.....
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) 
                     andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];

Step 3= Copy fbGraphCallback: Method from sample code and put in your controller

Step 4= Use this code to get Friends and it will give u the list of friend and who have same app install They look like

{
   "installed": true, 
   "id": "{USER_ID_GOES_HERE}"
}, 

Code is =

NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];

[variables setObject:@"installed" forKey:@"fields"];

FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me/friends" withGetVars:variables];

NSLog(@"getMeinstalled Friends:  %@", fb_graph_response.htmlResponse);

Thats it!!!!!!!!

answered 2012-06-26T07:02:56.020
3

I know 'iphone' is tagged in the question, but still this answer might help others who will reach here:
The FQL query to get (just) the ids of all user's friends who are also users of the app is:

SELECT uid FROM user WHERE is_app_user=true AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
answered 2012-11-08T19:22:56.580

Your Answer