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
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 *friend in data)
{
NSLog(@"name : %@ , bday : %@", [friend name],[friend birthday]);
[tempArray addObject:friend];
}
}];
}
}