I am using Facebook api to get Mutual Friend, but with the same account I am getting different number of Mutual Friend on Simulator and on actual devices. The code I am using :
NSDictionary *params = @{
@"fields": @"context.fields(all_mutual_friends.fields(picture.width(200).height(200),id,name)),id,name"
};
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:[NSString stringWithFormat:@"/%@",facebookId]
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
if (error) {
NSLog(@"%@", error);
} else {
NSLog(@"%@", result);
NSArray *fbResData = [app checkArrayNull:[[[result objectForKey:@"context"] objectForKey:@"all_mutual_friends"] objectForKey:@"data"]];
NSLog(@"%@", fbResData);
}
}];
I got the answer after some R&D from google. Just need to add Access Tocken in FBSDKGraphRequest at every call.
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:[NSString stringWithFormat:@"/%@",facebookId]
parameters:params
tokenString:strAccessTocken
version:nil
HTTPMethod:@"GET"];
And got the Mutual Friends on every call.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.