Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

objective c - iOS -deprecated permission-facebook friends birthday using Graph API

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The full list of permissions that have been removed from v2.0. Your app should not ask for any of the following from Facebook Ver 2.0:

create_event
manage_friendlists
read_requests
user_checkins
user_notes
user_online_presence
user_questions
user_subscriptions
xmpp_login
friends_about_me
friends_actions.books
friends_actions.fitness
friends_actions.music
friends_actions.news
friends_actions.video
friends_actions:APP_NAMESPACE
friends_activities
friends_birthday
friends_checkins
friends_education_history
friends_events
friends_games_activity
friends_groups
friends_hometown
friends_interests
friends_likes
friends_location
friends_notes
friends_online_presence
friends_photos
friends_questions
friends_relationships
friends_relationship_details
friends_religion_politics
friends_status
friends_subscriptions
friends_videos
friends_website
friends_work_history

ref : https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids

you Can fetch only friends

1. id,name,picture only.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...