0
我瀏覽了以前的所有帖子,找不到解決方案。我正在連接,它正在返回除電子郵件以外的所有內容。最近的版本是否有一些改變,現在允許我接收?FBSDK不返回用戶的電子郵件
下面是相關的代碼 -
-(void)checkFacebookFriends {
[FBSDKAccessToken refreshCurrentAccessToken:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"user_friends"]) {
[self makeFacebookFriendsRequest];
// TODO: publish content.
} else {
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
loginManager.loginBehavior = FBSDKLoginBehaviorWeb;
[loginManager logInWithReadPermissions:@[@"email", @"user_friends", @"public_profile"]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
//TODO: process error or result.
if (error == nil) {
[self makeFacebookFriendsRequest];
}
else {
NSLog(@"no");
}
}];
}
}];
}
-(void)makeFacebookFriendsRequest {
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:[NSString stringWithFormat:@"%@/friends", [FBSDKAccessToken currentAccessToken].userID]
parameters:@{@"fields": @"email,name,picture"}
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
NSMutableArray *temp = [NSMutableArray new];
for (NSDictionary *user in [result objectForKey:@"data"]) {
FacebookUser *fbUser = [[FacebookUser alloc] initWithDictionary:user error:nil];
[temp addObject:fbUser];
}
// self.facebookUsers = temp;
// [self.tableView reloadData];
// Handle the result
}];
}
Facebook只允許通過手機號碼註冊。這就是爲什麼你可能沒有得到電子郵件地址。 –
@BhavukJain我正在與我的團隊進行測試。他們通常都會註冊郵件,但仍然沒有看到。 –
我想你可以得到你登錄的帳戶的電子郵件地址,但不是你的朋友。 –