不能得到FBGraphUser电子邮件 [英] Cant get FBGraphUser email

查看:90
本文介绍了不能得到FBGraphUser电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用Facebook登录。 (Facebook iOS SDK版本3.11.1)



我要求电子邮件许可:

  NSArray * permissions = [NSArray arrayWithObjects:@basic_info,@email,nil]; 

大部分时间,我收到用户的电子邮件:

  NSString * email = [user objectForKey:@email]; 
// user is(NSDictionary< FBGraphUser> *)

有时我只是不。 (我可以看到NSDictionary不包括电子邮件)。



我正在使用此修复程序,所以当我以后使用电子邮件时,应用程序不会终止,它的nil: / p>

  NSString * email = [user objectForKey:@email]? [user objectForKey:@email]:@NO_EMAIL; 

但是我需要真正的邮件,所以我必须提出一个新的解决方案。
我没有注意到有问题的用户特别的东西。
任何想法可能是什么问题?

解决方案

似乎它是一个众所周知的问题...对于许多原因不是Facebook上的所有人都注册了电子邮件地址。



但正如我所说,我的问题是我需要一个真正的邮件。
所以最简单的解决方案是使用用户的Facebook电子邮件:user_name@facebook.com

  NSString * email = [ user objectForKey:@email]? [user objectForKey:@email]:[NSString stringWithFormat:@%@@ facebook.com,user.username]; 




  • 某些链接指向您无法将HTML电子邮件发送到Facebook邮件,只有纯文本!


I use Facebook login with my app. (Facebook iOS SDK version 3.11.1)

I ask for "email" permission:

NSArray *permissions = [NSArray arrayWithObjects: @"basic_info", @"email", nil];

Most of the time, I do get the user's email like that:

NSString *email = [user objectForKey:@"email"];
//user is (NSDictionary<FBGraphUser> *)

Sometimes I just don't. (I can see that the NSDictionary is not including email).

I am using this fix so the app won't terminate when i use email later and its nil:

NSString *email = [user objectForKey:@"email"] ? [user objectForKey:@"email"] : @"NO_EMAIL";

But i need the real mail, so i have to come up with a new solution. I haven't noticed something special with the problematic users. Any ideas what can be the problem?

解决方案

It appears that its a well known problem... For many reasons, not everyone on Facebook have Email address registered.

But as i said, my problem is that i need a real mail. So the simplest solution is to use the user's Facebook Email : user_name@facebook.com

NSString *email = [user objectForKey:@"email"] ? [user objectForKey:@"email"] : [NSString stringWithFormat:@"%@@facebook.com", user.username];

  • some links ref to that you can't sent HTML emails to the Facebook mail, only plain text!

这篇关于不能得到FBGraphUser电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆