I\'ve just updated facebook sdk v4.0
and according the tutorial of Using Custom Login UIs
-(IBAction)facebookLoginClick:(id)sender {
FBSDKLoginManag
Swift 4.0 and FBSDKCoreKit 4.33
let loginManager = LoginManager()
if let currentAccessToken = AccessToken.current, currentAccessToken.appId != SDKSettings.appId
{
loginManager.logOut()
}
Swift 3.0
func loginWithFacebook
{
let loginManager = FBSDKLoginManager()
if let currentAccessToken = FBSDKAccessToken.current(), currentAccessToken.appID != FBSDKSettings.appID()
{
loginManager.logOut()
}
loginManager.logIn(withReadPermissions: ["public_profile","email"], from: self, handler: { (result, error) in
if error != nil {
print("error\(String(describing: error))")
}
else if (result?.isCancelled)! {
}
else {
print(FBSDKAccessToken.current())
}
})
}
According to the docs, 304 FBSDKLoginUserMismatchErrorCode "Indicates a failure to request new permissions because the user has changed".
Make sense in the scenario @Adrian999 mentioned.
Single Sign On
I've also found that this issue happens if you have an app that does not require single sign on (i.e. an app which multiple users will create content and share from one device).
You can change single sign on in your app settings https://developers.facebook.com/apps/your-app-id/settings/.
304 indicates that nothing has changed. Probably you are somehow already authenticated and so getting nil with 304 indicating nothing has changed.
I had this, it occurred when changing the FB app details in Xcode while an iOS app was running. You need to delete the app from the device and then republish with the new FB app setup. Just recompiling is not enough to clear the old FB settings