【问题标题】:Fetching all friend's birthday in Facebook iOS 7在 Facebook iOS 7 中获取所有朋友的生日
【发布时间】:2014-08-08 21:03:56
【问题描述】:

如何使用图形 API 获取有关我朋友的所有信息?

这是我的代码:

LoginViewController.m(视图控制器):

- (IBAction)loginButtonTouchHandler:(id)sender
{
    // Set permissions required from the facebook user account
    NSArray *permissionsArray = @[@"public_profile", @"email", @"user_friends", @"user_birthday", @"friends_birthday"];

    // Login PFUser using facebook
    [PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {

        if (user) {
            [FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                if (!error) {
                    [self.navigationController popToRootViewControllerAnimated:YES];
                    // Store the current user's Facebook ID on the user
                    [[PFUser currentUser] setObject:[result objectForKey:@"email"]
                                             forKey:@"email"];
                    [[PFUser currentUser] setObject:[result objectForKey:@"name"]
                                             forKey:@"name"];
                    [[PFUser currentUser] saveInBackground];

                }
            }];
        }
    }];

}

CalendarViewController.m (UITableViewController) :

- (void)viewDidLoad
{
    [super viewDidLoad];
    [FBRequestConnection  startWithGraphPath:@"/me/friends"
                                      parameters:nil
                                      HTTPMethod:@"GET"
                               completionHandler:^(
                                                   FBRequestConnection *connection,
                                                   id result,
                                                   NSError *error
                                                   ) {
        if (!error) {
            // Success! Include your code to handle the results here
            NSLog(@"user info: %@", result);
        } else {
            NSLog(@"problem");
            // An error occurred, we need to handle the error
            // See: https://developers.facebook.com/docs/ios/errors
        }
    }];

这是我的 NSLog:

"2014-08-08 22:55:16.615 Mindle[803:60b] user info: {
    data =     (
    );
    summary =     {
        "total_count" = 779;
    };
}"

这算我的朋友们,但是有没有办法获取他们的生日日期?

【问题讨论】:

    标签: ios facebook facebook-graph-api calendar fetch


    【解决方案1】:

    在 API v2.0 或更高版本中,您无法访问您朋友的生日。

    【讨论】:

    • 在 API v2.1 中?还是有其他解决办法?
    • 它仅在 API v1.0 中可用。不在 v2.0 或更高版本中
    • 好吧…… :(你知道其他解决方案吗?
    • 不,这是不可能的
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多