Ios 具有电子邮件地址的FBSDKLoginManager令牌
我正试图通过facebook SDK在我的iOS应用程序中注册 我使用FBSDKLoginManager登录到facebook,因为我得到了我已经验证过的AccessTokenIos 具有电子邮件地址的FBSDKLoginManager令牌,ios,facebook,facebook-graph-api,Ios,Facebook,Facebook Graph Api,我正试图通过facebook SDK在我的iOS应用程序中注册 我使用FBSDKLoginManager登录到facebook,因为我得到了我已经验证过的AccessToken https://graph.facebook.com/me?access_token=tokenstring 我得到了姓名和Id的回复,但我还需要收到电子邮件,以便在Qiuckblox上注册 我已经从github下载了q-municate应用程序(基于quickblox.com),并检查了令牌。 我有相同的标记,但结果
https://graph.facebook.com/me?access_token=tokenstring
我得到了姓名和Id的回复,但我还需要收到电子邮件,以便在Qiuckblox上注册
我已经从github下载了q-municate应用程序(基于quickblox.com),并检查了令牌。我有相同的标记,但结果不同。怎么会? 也许我应该在facebook上设置一些设置
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");
}
}
}];
以下是截图:
您需要显式枚举所有需要的字段:
https://graph.facebook.com/v2.5/me?fields=id,姓名,电子邮件,性别和访问权\u令牌=
像这样改变
[[[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"];
}