I have integrated facebook connect into my Xcode 4 project for an iPhone. Here is the code for iPhone FBconnec. FBconnect.h and 开发者_StackOverflow社区FBSession.h already included.
- (void)viewDidLoad{ _session = [[FBSession sessionForApplication:@"APPKey"
secret:@"APPSecret"
delegate:self]retain];
FBLoginButton* fbButton = [[[FBLoginButton alloc] init] autorelease];
fbButton.frame = CGRectMake(228, 50, 85, 50);
[self.view addSubview:fbButton]; }
The code is working fine, but for some facebook accounts when run the FQL query to select email from user. I get NULL as shown below
length of users Array: (
{
"contact_email" = "<null>";
email = "<null>";
"first_name" = Ali;
"last_name" = Subhani;
uid = 696377693;
}
How can I get the extended permission. I am just using following code to run the query. Which contains word params, I think it has to do something with FBRequest. Have a look at the code below
- (void)getFacebookName {
//==================== MAKING FACEBOOK REQUEST =============================
NSString* fql = [NSString stringWithFormat:
@"select uid,first_name,last_name,email from user where uid == %lld",
self._session.uid];
NSDictionary* params =
[NSDictionary dictionaryWithObject:fql
forKey:@"query"];
[[FBRequest requestWithDelegate:self]
call:@"facebook.fql.query" params:params];}
Where should I enter extended permissions so I can get user email.
Thanks.
I use
[appDelegate.facebook authorize:
[NSArray arrayWithObjects:
@"offline_access", @"email", @"user_checkins", @"publish_checkins", nil]
delegate:delegate
localAppId:localAppId];
...to authorize and request email access (using the @"email"
permissions key above). I'm not sure if a user can have NO email address, as they have at least one to login with.
However, Facebook gives the user the option to obfuscate it from you with an arbitrary @facebook.com account that forwards to their regular email account.
精彩评论