Take the 2-minute tour ×

Can anyone help me. I cannot figure out how to make a single FQL query using the latest Facebook SDK (v 3.1) for iOS to get birthday and email of user's friend. When I query for fields like name i get the correct value but get null for email and birthday field.

Here is my code

- (void)facebookViewControllerDoneWasPressed:(id)sender {

    // we pick up the users from the selection, and create a string that we use to update the text view
    // at the bottom of the display; note that self.selection is a property inherited from our base class
    for (id<FBGraphUser> user in _friendPickerController.selection) {
        _nameTxt.text = user.name;
        NSString *fql = [NSString stringWithFormat:@"SELECT email, birthday, name FROM user WHERE uid = %@ ",user.id];
        NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:fql forKey:@"q"];
        [FBRequestConnection startWithGraphPath:@"/fql"
                              completionHandler:^(FBRequestConnection *connection,
                                              id result,
                                                      NSError *error) {
                                  if (error) {
                                      NSLog(@"Error: %@", [error localizedDescription]);
                                  } else {
                                      NSLog(@"Result: %@", result);

    [self.navigationController dismissModalViewControllerAnimated:YES];

I'm getting value for name but null for email and birthday.


share|improve this question
What permissions has your app asked for? Did you ask for email and user_birthday? –  C Abernathy Dec 14 '12 at 1:28
@CAbernathy I dont think so my app is asking for these permissions. I'm new to this Facebook Graph API, can you please tell me what I need to do? –  Aditya Mathur Dec 14 '12 at 4:50
this question has got me the answer which i couldn't find anywhere else.. –  Dhaval Nena Mar 3 at 9:23

1 Answer 1

up vote 3 down vote accepted

Before you call your query, you'll need to have the user log in and ask for email and user_birthday permissions. For example:

- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                     completionHandler:^(FBSession *session,
                                                     FBSessionState state,
                                                     NSError *error) {
                                     [self sessionStateChanged:session

The above method is used in the context of this tutorial:


Also check out the FQL tutorial:


share|improve this answer

Your Answer


