I am new to iOS .
I am trying to fetch birthdays of all friends from a Facebook account.
I followed Developers.facebook
I have requested all the necessary permissions :user_friends
, friends_birthday
, read_stream
. I have also set permissions in the Graph Api Explorer.
First I used the graph path : @"/me/friends?fields=name,id,birthday"
. It is returning only name and id of friends who have used the app.
I searched in the web and tried out @"/me/taggable_friends"
. It is given in the developer site that we can access only three fields for this taggable_friends : id,name,picture
.
I found that facebook has deprecated friends details permissions. Please refer https://developers.facebook.com/docs/apps/upgrading
-(void)pickFriendsClick
{
NSArray *permissions = [[NSArray alloc] initWithObjects: @"user_birthday",@"friends_hometown",@"friends_birthday",@"friends_location",nil];
if (![[FBSession activeSession]isOpen]) {
if (APP.fb) {
APP.fb =[[FBSession alloc]initWithPermissions:permissions];
}
}
FBRequest *friendRequest = [FBRequest requestForGraphPath:@"/me/taggable_friends"];
[friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSArray *data = [result objectForKey:@"data"];
NSMutableArray *friends= [data mutableCopy];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"updated_time" ascending:TRUE];
[friends sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
for (FBGraphObject<FBGraphUser> *friend in friends) {
NSLog(@"%@:%@", [friend name],[friend birthday]);
}}]; }
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…