我正在使用facebook-ios-sdk-3.10,使用此SDK我将登录并从FB获取用户详细信息它对我来说很好。
这是我正在使用的代码
- (IBAction)fbLogin_click:(id)sender
{
if (AppDelegate.fbsession.state != FBSessionStateCreated) {
// Create a new, logged out session.
NSArray *permissions = [NSArray arrayWithObjects:@"offline_access", @"email", @"publish_stream", @"read_stream",@"read_friendlists",@"manage_friendlists",@"friends_about_me",@"publish_actions", nil];
// create a session object, with defaults accross the board, except that we provide a custom
// instance of FBSessionTokenCachingStrategy
AppDelegate.fbsession = [[FBSession alloc] initWithAppID:nil
permissions:permissions
urlSchemeSuffix:nil
tokenCacheStrategy:nil];
}
FBSessionLoginBehavior behavior = FBSessionLoginBehaviorForcingWebView;
if (AppDelegate.fbsession.state != FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[AppDelegate.fbsession openWithBehavior:behavior completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
if (error)
{
NSLog(@"Error");
}
[self GetFBUserDetails];
}];
}
}
-(void) GetFBUserDetails
{
if (AppDelegate.fbsession.isOpen)
{
[HUD show:YES];
// fetch profile info such as name, id, etc. for the open session
FBRequest *me = [[FBRequest alloc] initWithSession:AppDelegate.fbsession graphPath:@"me"];
self.pendingRequest= me;
[me startWithCompletionHandler:^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
// because we have a cached copy of the connection, we can check
// to see if this is the connection we care about; a prematurely
// cancelled connection will short-circuit here
if (me != self.pendingRequest) {
return;
}
self.pendingRequest = nil;
// self.pendingLoginForSlot = -1;
// we interpret an error in the initial fetch as a reason to
// fail the user switch, and leave the application without an
// active user (similar to initial state)
if (error) {
return;
}
[AppDelegate.fbsession closeAndClearTokenInformation];
[FBSession.activeSession close];
[FBSession.activeSession closeAndClearTokenInformation];
FBSession.activeSession=nil;
[self FacebookCustomerRegister:user];
}];
}
}
在这种情况下,一些用户通过电子邮件创建Facebook帐户而不是他的帐户,当他尝试通过我的应用程序登录时,单击登录按钮后显示空屏幕,没有进一步的操作。如何通知用户“您还没有验证您的FB帐户”,它不会返回到我的应用程序。我如何从那里获取响应?
任何人都可以帮助我吗?
答案 0 :(得分:0)
使用Graph API或FQL查询从Facebook获得的电子邮件地址是经过验证的电子邮件。如果某个帐户尚未验证该电子邮件,则无法获取该电子邮件。
因此,当您获取用户信息时,如果您在获得获取权限时未收到电子邮件,则用户未经过验证,您可以向用户显示有关验证电子邮件和信息的提醒或任何信息
在此处查看更多详细信息Is it possible to check if an email is confirmed on Facebook?