I am getting total count in the response, but the data is empty. Can anyone help me with this.
Asked
Active
Viewed 314 times
0
-
Perhaps this will help: http://stackoverflow.com/questions/23417356/facebook-graph-api-v2-0-me-friends-returns-empty-or-only-friends-who-also-u – Robert J. Clegg Jan 20 '17 at 12:07
1 Answers
0
You can retrieve a list of the user's friends after requesting the user_friends
permission and running the below code, this will return the uid
of each friend.
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{user-id}/friends"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
To fetch friends on a specific friends list you will need to request the permission read_custom_friendlists
and run the below code with the friendw list id returned from the /{user-id}/friendlists
edge
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{friend-list-id}"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];

Leon Storey
- 3,274
- 2
- 25
- 40
-
Thanks for ur response. I have a doubt. Should i pass /{user-id}/friends or /{123456789}/friends. – Natarajan Chandrasekharan Jan 20 '17 at 11:26
-
`{user-id}` is a placeholder, you should use `/123456789/friends`. – Leon Storey Jan 20 '17 at 11:28
-
Thanks for your response. I am not getting data. The response is data = ( ); summary = { "total_count" = 796; }; – Natarajan Chandrasekharan Jan 20 '17 at 11:31
-
@NatarajanChandrasekharan Have you requested the permissions above? – Leon Storey Jan 20 '17 at 12:09
-
I am not getting data. But i am getting total count. How to get the data. Can anyone help with this. – Natarajan Chandrasekharan Jan 20 '17 at 12:11
-
@NatarajanChandrasekharan As per my above comment, you need to request the permissions to retrieve data. Have you done this? As soon as you request and allow permission `user_friends`, data will be returned. – Leon Storey Jan 20 '17 at 13:24
-
Can you please comment me the code to request for permission – Natarajan Chandrasekharan Jan 21 '17 at 04:48