首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有电子邮件地址的FBSDKLoginManager令牌

带有电子邮件地址的FBSDKLoginManager令牌
EN

Stack Overflow用户
提问于 2015-12-18 18:12:03
回答 2查看 355关注 0票数 4

我正试图通过facebook在我的iOS应用程序中注册

我使用FBSDKLoginManager登录到facebook,因为我得到了AccessToken,我已经验证了。

代码语言:javascript
复制
https://graph.facebook.com/me?access_token=tokenstring

我得到了姓名和Id作为回应,但我需要获得电子邮件,也登记在,丘克博客,

我从github下载了q-municate应用程序(基于quickblox.com)并检查了令牌。

我有相同的记号,但结果不同。怎么会这样?也许我应该在facebook上设置一些设置?

代码语言:javascript
复制
    FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logOut];

[login logInWithReadPermissions:@[@"email", @"public_profile", @"user_friends"]
             fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

    if (error) {
        // Process error
        NSLog(@"%@",error.localizedDescription);
    }
    else if (result.isCancelled) {
        // Handle cancellations
    }
    else {
        NSLog(@"%@",result.token.tokenString);

        if ([result.grantedPermissions containsObject:@"email"]) {
            NSLog(@"Granted all permission");
            if ([FBSDKAccessToken currentAccessToken]) {
                [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"id, name, link, first_name, last_name, picture.type(large), email, birthday, bio ,location ,friends ,hometown , friendlists"}] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
                    if (!error) {
                        NSLog(@"%@",result);
                    }
                }];
            }
        } else {
            NSLog(@"Not granted");
        }
    }
}];

在这里截图:

http://screencast.com/t/9KNK9HIb

http://screencast.com/t/BDsfYVZi

EN

回答 2

Stack Overflow用户

发布于 2015-12-30 10:05:38

您需要显式枚举所需的所有字段:

https://graph.facebook.com/v2.5/me?fields=id,name,email,gender&access_token=<access_token>

票数 0
EN

Stack Overflow用户

发布于 2015-12-30 10:12:38

代码语言:javascript
复制
    [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"id, name, first_name, last_name, picture.type(large), email"}]

     startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
         if (!error)
         {
             NSLog(@"results:%@",result);

             NSString *email = [result objectForKey:@"email"];
          }

像这样的变化

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34361600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档