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.
Once you've authorised the user and obtained an access token, you can quickly determine which of their friends have already authorised your app with a call to /me/friends?fields=installed
For the users' friends who have already authorised the app, the result will look like this:
{
"installed": true,
"id": "{USER_ID_GOES_HERE}"
},
and for the users who have not already authorised the app, the result will look like this:
{
"id": "{USER_ID_GOES_HERE}"
},
If you're doing this in the iOS SDK you won't see that exact return value, but the SDK should put the results into a data structure you can use, and check for the presence of the 'installed' item
You can also request additional User object fields other than just 'installed', but this is just a quick example to show you how to get the list of friends that use the app
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!!!!!!!!
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())