-2

Methods which I have used:

- (void)  loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error

- (BOOL) loginButtonWillLogin:(FBSDKLoginButton *)loginButton

- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
  • use Userdefault for your concept,but with out click the FB button how do u know – Anbu.Karthik Mar 14 '16 at 12:02
  • I guess that you register not in facebook, and only register in your app thorough facebook. In second case, your server should response to you, is there an existing user or not. – Mr.Fingers Mar 14 '16 at 12:05

1 Answers1

0

Save FBID in NSuserdefault.

And On login page compare OLDFBID(stored in NSUserdefaults) with NEWFBID. If both are matched then it is existing user. And not matched then New user. and store new FBID in NSUserdefault.

Like ,

// Here posted logic (without syntax) only so, dont copy and paste it. just observe logic.

When userlogin,

If (nsuserdefault ==nil)
{
 //store FBID in userdefault
FBID = (Store here); // 
}
else //If value available in nsuserdefault
   {
     if (OLDFBID == NEWFBID)
      {
       // Existing User
      }
     else 
     {
        //New user 
       // Replace new FBID with OLD in NSUserdefault.
     }

}

Note :- Don't clear NSUserdefault at logout.

Badal Shah
  • 7,541
  • 2
  • 30
  • 65