iOS -deprecated permission-facebook friends birthday using Graph API

后端 未结 2 1811
温柔的废话
温柔的废话 2020-12-22 02:06

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 nec

相关标签:
2条回答
  • 2020-12-22 02:45

    I have fetched friends by this code in new facebook sdk. This might be helpful.

    NSArray *permissions =     [NSArray arrayWithObjects:@"email", @"user_birthday",@"friends_hometown",@"friends_birthday",@"friends_location",@"publish_stream",@"user_friends",@"public_profile",nil];
    
    [self appDelegate].session = [[FBSession alloc] initWithPermissions:permissions];
    
    [[self appDelegate].session openWithCompletionHandler:^(FBSession *session,
                                                            FBSessionState status,
                                                            NSError *error) {
    
        if(!error)
        {
            NSLog(@"success");
            [self fetchFriends];
        }
        else
        {
            NSLog(@"failure");
        }
    
    
    
    }];
    

    then method fetch friend is

    -(void)fetchFriends
    {
        if ([self appDelegate].session.isOpen)
        {
            [FBSession setActiveSession:[self appDelegate].session];
            FBRequest *friendRequest = [FBRequest requestForGraphPath:@"/me/friends?fields=name,picture,birthday,location"];
            [ friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                NSArray *data = [result objectForKey:@"data"];
    
                NSLog(@"response : %@",data);
    
                for (FBGraphObject<FBGraphUser> *friend in data)
                {
                    NSLog(@"name : %@ , bday : %@", [friend name],[friend birthday]);
    
                    [tempArray addObject:friend];
                }
            }];
        }
    }
    
    0 讨论(0)
  • 2020-12-22 03:10

    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.
    
    0 讨论(0)
提交回复
热议问题