Methods which I have used:
- (void) loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
- (BOOL) loginButtonWillLogin:(FBSDKLoginButton *)loginButton
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
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.