I am trying to get an email address from a user. He logs in, I ask permission to access the email, and he selects normally. Then I use the graphics API from facebook to access the email address.
- (void) fbDidLogin { btnLogin.isLoggedIn = TRUE; [btnLogin updateImage]; NSString *theURL = [ [NSString stringWithFormat: @"https://graph.facebook.com/me?access_token=%@", facebook.accessToken ]stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding ]; NSLog(@"%@", theURL); [facebook requestWithGraphPath: theURL andDelegate: self]; } ... - (void)request:(FBRequest*)request didLoadRawResponse:(NSData*)data { NSString *response = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; NSLog(@"%@", response); [response release]; }
This is how I get the information:
- (void) request:(FBRequest*)request didLoad:(id)result { if ([result isKindOfClass:[NSDictionary class]]) { NSString *email = [result objectForKey: @"email"]; NSString *name = [result objectForKey: @"name"]; NSString *facebookId = [result objectForKey: @"id"];
It gives me only this line: { id = "https://graph.facebook.com/me"; } { id = "https://graph.facebook.com/me"; } What have I done wrong?
objective-c iphone facebook facebook-graph-api
gyozo kudor
source share