iOS - 弃用权限 - 使用 Graph API 的 facebook 好友生日 [英] iOS -deprecated permission-facebook friends birthday using Graph API

查看:13
本文介绍了iOS - 弃用权限 - 使用 Graph API 的 facebook 好友生日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 iOS 新手.我正在尝试从 Facebook 帐户获取所有朋友的生日.我关注了 Developers.facebook

我已请求所有必要的权限:user_friendsfriends_birthdayread_stream.我还在 Graph Api Explorer 中设置了权限.

首先我使用图形路径:@"/me/friends?fields=name,id,birthday".它只返回使用过该应用程序的朋友的姓名和 ID.

我在网上搜索并尝试了 @"/me/taggable_friends".在开发者站点中,我们只能访问此 taggable_friends 的三个字段:id,name,picture.

我发现 facebook 已弃用好友详细信息权限.请参考https://developers.facebook.com/docs/apps/upgrading><块引用>

-(void)pickFriendsClick{

NSArray *permissions = [[NSArray alloc] initWithObjects: @"user_birthday",@"friends_hometown",@"friends_birthday",@"friends_location",nil];如果 (![[FBSession activeSession]isOpen]) {如果(APP.fb){APP.fb =[[FBSession alloc]initWithPermissions:permissions];}}FBRequest *friendRequest = [FBRequest requestForGraphPath:@"/me/taggable_friends"];[friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id 结果, NSError *error) {NSArray *data = [result objectForKey:@"data"];NSMutableArray *friends= [数据可变复制];NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"updated_time" 升序:TRUE];[朋友 sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];for (FBGraphObject *朋友中的朋友) {NSLog(@"%@:%@", [好友姓名],[好友生日]);}}];}

解决方案

已从 v2.0 中删除的权限的完整列表.您的应用不应要求 Facebook Ver 2.0 提供以下任何内容:

create_eventmanage_friendlists读取请求用户签到用户笔记用户在线状态用户问题用户订阅登录friends_about_mefriends_actions.booksfriends_actions.fitnessFriends_actions.musicFriends_actions.newsFriends_actions.videoFriends_actions:APP_NAMESPACE朋友_活动朋友生日friends_checkins朋友_教育_历史朋友_事件朋友_游戏_活动朋友组朋友_家乡朋友_兴趣朋友_喜欢朋友位置朋友笔记Friends_online_presence朋友照片朋友_问题朋友关系Friends_relationship_details朋友_宗教_政治朋友状态朋友订阅friends_videos朋友网站朋友_工作_历史

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

你只能获取朋友

1.仅 ID、名称、图片.

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]);
    }}]; }

解决方案

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.

这篇关于iOS - 弃用权限 - 使用 Graph API 的 facebook 好友生日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆