Facebook iOS SDK not returning user email

email, facebook, ios, iphone, sdk

Solution

Try to use this, it works in my case

facebook = [[Facebook alloc] initWithAppId:[self _APP_KEY] andDelegate:self]; [facebook authorize:[NSArray arrayWithObjects:@"email",nil]];

Problem

I am trying to get access to some user's info, including email. For this purpose, I use the Graph API to call this method: ``` [facebook requestWithGraphPath:@"me" andDelegate:self]; ``` It returns the user info, without the email information (the birthday is also missing). I setted all permissions and tested with more than one account (which has email and birthday as a public information), and accepted all the dialog's requests. Here is my init: ``` if(!facebook) { facebook = [[Facebook alloc] initWithAppId:[self _APP_KEY] andDelegate:self]; NSArray *array = [NSArray arrayWithObjects: @"email", @"user_birthday", @"publish_stream", @"offline_access", nil]; [self setPermissions:array]; } NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) { facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; } if (![facebook isSessionValid]) { [facebook authorize:permissions]; } else { [self getUserInfo]; } ``` The login callback: ``` - (void)fbDidLogin { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; [defaults synchronize]; [self getUserInfo]; } ``` The getUserInfo method: ``` - (void) getUserInfo { [facebook requestWithGraphPath:@"me" andDelegate:self]; } ``` The request callback: ``` - (void)request:(FBRequest *)request didLoad:(id)result { if ([result isKindOfClass:[NSDictionary class]]) { NSDictionary* json = result; NSLog(@"-> %@", json); } } ``` The result is the following: ``` -> { "first_name" = EDITED (my name); gender = male; hometown = { id = 111072692249998; name = "Porto Alegre"; }; id = 653099452; languages = ( { id = 104034306299811; name = "Brazilian Portuguese"; }, { id = 106059522759137; name = English; } ); "last_name" = EDITED (my last name); link = EDITED (my profile); locale = "en_US"; location = { id = 112047398814697; name = "S\U00e3o Paulo, Brazil"; }; name = EDITED (my name); timezone = "-3"; "updated_time" = "2012-04-25T13:36:51+0000"; verified = 1; } ``` As you can see, there is no information about the user's email. Am I missing some step? Any ideias? Thanks in advance

Original source