我正试图通过facebook在我的iOS应用程序中注册
我使用FBSDKLoginManager登录到facebook,因为我得到了AccessToken,我已经验证了。
https://graph.facebook.com/me?access_token=tokenstring我得到了姓名和Id作为回应,但我需要获得电子邮件,也登记在,丘克博客,。
我从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");
}
}
}];在这里截图:
http://screencast.com/t/9KNK9HIb
http://screencast.com/t/BDsfYVZi
发布于 2015-12-30 10:05:38
您需要显式枚举所需的所有字段:
https://graph.facebook.com/v2.5/me?fields=id,name,email,gender&access_token=<access_token>
发布于 2015-12-30 10:12:38
[[[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"];
}像这样的变化
https://stackoverflow.com/questions/34361600
复制相似问题