Facebook login fails (always isCancelled) after upgrading to SDK 4.1

Thanks to Dheeraj and its answer to a similar question, I found the error in my calls. I just made the stupidest error in Swift. In the unlikely event someone as dumb as I am read this, here are the 3 calls in Swift that you should add in your AppDelegate.swift. They are tested and working:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    // Do what you have to do but at the end, instead of 'return true', put :

    return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

func applicationDidBecomeActive(application: UIApplication) {
    FBSDKAppEvents.activateApp()
}

I found the solution, the problem is that you don't complete the Facebook login process.

when you make facebook login request and then the user uses login via facebook app, The Facebook app opens again your application and call to

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool

on app delegate, to complete the process you need to pass facebook SDK the URL that came from Facebook that way:

  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options) == true {
    }

Then you will see that the login request will return access token and won't be canceled.