如何使用图形API获取有关我朋友的所有信息?
这是我的代码:
LoginViewController.m(ViewController):
- (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;
};
}"
这对我的朋友很重要,但有没有解决方案来获取他们的birthday_date?
答案 0 :(得分:0)
在API v2.0或更高版本中,您无法访问朋友的生日。