2014-01-06 5 views
0

이 SDK를 사용하여 로그인하고 FB에서 사용자 정보를 가져옵니다. 저에게 잘 작동합니다. 페이스 북을 통한 로그인 iOS의 로그인

내가 그런 경우

- (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]; 
     }]; 
    } 
} 

을 uisng있어 그가 내 응용 프로그램을 통해 로그인 할 때 일부 사용자가 이메일을 통해 매우 자신의 계정을 페이스 북 계정을 생성하지 코드는 클릭 로그인 후 빈 화면을 보여줍니다입니다 버튼을 누르면 더 이상의 조치가 없습니다. 사용자에게 "FB 계정을 아직 ​​확인하지 않았습니다."라고 알리고 내 앱으로 돌아 가지 않을 수있는 방법은 무엇입니까? 거기에서 응답을 가져올 수 있습니까?

누구든지 나를 도울 수 있습니까?

답변

0

그래프 API 또는 FQL 쿼리를 사용하여 Facebook에서 얻은 이메일 주소는 확인 된 이메일입니다. 계정에서 이메일을 아직 확인하지 않은 경우 계정을 가져올 수 없습니다.

은 그래서 당신은 사용자 정보를 가져올 때 당신은 이메일을받지 않은 경우 당신이 얻을 수있는 권한이있는 경우 다음 사용자는 더는 확인되지 않고 당신은 경고 또는 이메일 및 정보

확인에 대한 사용자에 대한 정보를 표시 할 수 있습니다 여기

체크 자세히 Is it possible to check if an email is confirmed on Facebook?

+0

안녕이 페이지를 참조하시기 바랍니다, 나는 화면 반바지 추가가 http://stackoverflow.com/questions/20946555/facebook-login-via-app-with-unverified-user-account-in -fb – Rajesh

+0

올바른 문제를 해결할 수있는 사파리로 앱을 전환하는 이유 – Retro

관련 문제