سؤال

Using this methods Facebook iOS 6 - get user info I can get the profile user info from Facebook, but in the json file are not retrieving the email of the user.

Can you helpme to get the email??

Thanks in advance!

هل كانت مفيدة؟

المحلول

You should get email in this way:

[user objectForKey:@"email"]//Where user is FBGraphUser type

Here is the implementation when login is successful

case FBSessionStateOpen: {

            NSLog(@"accessToken: %@", session.accessTokenData.accessToken);
            [[FBRequest requestForMe] startWithCompletionHandler:
             ^(FBRequestConnection *connection,
               NSDictionary<FBGraphUser> *user,
               NSError *error) {
                 if (error) {
                     //error
                 }else{
                     NSLog(@"%@, %@",[user objectForKey:@"email"], user.description);

                 }
             }];
        }
         break;

نصائح أخرى

Try this :

facebook = [[Facebook alloc] initWithAppId:[self _APP_KEY] andDelegate:self]; 
[facebook authorize:[NSArray arrayWithObjects:@"email",nil]];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top