The whole purpose of logging into Facebook is to allow a quick and easy login to your Facebook account without re-entering your credentials.
To achieve this, the Facebook SDK is trying to use credentials that are already stored on the device, which may include:
- Facebook login information.
- cookies associated with logging into Facebook in Safari (directly or through
SFSafariViewController ) - Facebook system accounts
When you log out, you only have the SDK for Facebook, which forget the credentials in the application (it clears the token). When you log in again, it acts like the first time you did this, and if it finds an existing user, it will use it (the Facebook SDK makes it generally valid, the assumption that there is one person using device and they have one Facebook account).
The current βfavoriteβ path for the Facebook SDK (although it depends on the SDK versions, iOS versions, and possibly other parameters) is SFSafariViewController , which uses cookies with Safari, and not with your application.
If you want the user to log out completely on the device, they would have to use the Facebook logout link in Safari (or SFSafariViewController ).
If you want to do this programmatically, you can open the following URL in Safari or SFSafariViewController:
https://www.facebook.com/logout.php?next=[YourAppURL]&access_token=[ValidAccessToken]
You will need to use a custom URL scheme to return to your application / exit SFSafariViewController .
source share