[英]Get Facebook friends with Parse.com iOS
以下是我的代碼,用於為用戶登錄獲取Facebook朋友。
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/friends" parameters:@{@"fields": @"email, name, first_name, last_name, user_friends, id"}];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error)
{
if (!error)
{
NSArray *friendObjects = [result objectForKey:@"data"];
NSMutableArray *friendIds = [NSMutableArray arrayWithCapacity:friendObjects.count];
// Create a list of friends' Facebook IDs
for (NSDictionary *friendObject in friendObjects) {
[friendIds addObject:[friendObject objectForKey:@"id"]];
}
// Construct a PFUser query that will find friends whose facebook ids
// are contained in the current user's friend list.
PFQuery *friendQuery = [PFUser query];
[friendQuery whereKey:@"fbId" containedIn:friendIds];
[friendQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (error) {
} else {
self.friendUsers = objects; // self.friendUsers in array
[self.tableView reloadData];
}
}];
}
}];
我沒有得到任何結果,也不確定為什么我要遵循這里的步驟https://parse.com/questions/how-can-i-find-parse-users-that-are-facebook-friends-with-the-current -用戶
請幫忙
user_friends Facebook權限僅將已批准user_friends
權限到應用程序的用戶的好友返回。
為了使一個人出現在一個人的朋友列表中,兩個人都必須決定與您的應用共享他們的朋友列表,並且在登錄時未禁用該權限。 同樣,必須在登錄過程中要求兩個朋友都提供user_friends。 1個
因此,除非您的某些Facebook朋友已經批准了對同一應用程序的許可,否則您將獲得一個空朋友的列表。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.