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

I have upgraded Facebook SDK from 3.21.1 to 4.1 in an iOS app (already live).

I followed carefully the upgrade guide, and implemented the new methods for login. The code I used is the one provided in Facebook documentation.

But since the upgrade, each time I try to log in (device or simulator, webview or Facebook app), I can go through the login flow successfully, but when I fall back on my app, the login does not return any error but returns a FBSDKLoginManagerLoginResult "isCancelled".

As a workaround, I tried to implement app invites, which do not require login, but I'm stuck with a "Attempting to authenticate in FB" in the console... No luck here either.

So I guess it has something to do with the authentication fallback and the URL scheme in the info.plist, but I double checked there, and the data (which was working fine before the upgrade) is the same as the one indicated in Facebook documentation.

Anyone has any clue?? Thanks!

What I already checked:

  • I did not change the info.plist which was already set up to use Facebook SDK and worked fine before the upgrade.
  • The user account I use for login also worked fine before this upgrade.
  • I do not have any currentAccessToken before or after Login process.

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()
}

logInWithReadPermissions returning isCancelled value always true , I got this problem, with ios13 "react-native-fbsdk": "^0.10.1", I'm using sdk and react-native-fbsdk version is 0.8.0 [iOS][Facebook] Not redirecting back to app after Facebook. isCancelled after pressing login button #689 For those who are having errors on Xcode when upgrading from 0.8.0 to 0.10.0. BillBunting changed the title Facebook Sign-in UI Fails on iOS 13 / Xcode 11 (AWSMobileClient.default().showSignIn) -canOpenURL: failed for URL: "fbauth2:/" Facebook Sign-in UI Fails on iOS 13 / Xcode 11 (AWSMobileClient.default().showSignIn) Facebook SDK 5.8 required. Oct 11, 2019

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.

iOS/Swift/FBSDKLoginKit: Login using FBSDKLoginManager , logInWithReadPermissions gets failed by getting result. Example not using Parse Facebook login fails (always isCancelled) after upgrading to SDK 4.1 This is� When I log in my phone is saying Login failed check internet Related Help Center FAQs; How do I get Facebook recovery login codes to use when I don How do I log out of my mobile Facebook account if I don't ha Why am I asked to save my computer to my account when I log Can I connect to Facebook with no data charges on my mobile

Thumbs up for your help winterized. And thanks Dheeraj bhai. Here I'm just updating the answer for Swift 3.1.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}

func application(_ application: UIApplication, open url: URL,      sourceApplication: String?, annotation: Any) -> Bool {
    return   FBSDKApplicationDelegate.sharedInstance().application(application, open: url as URL!, sourceApplication: sourceApplication, annotation: annotation)
}

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

And yes don't forgot to put:

import FBSDKCoreKit

in App Delegate.

iOS Facebook SDK: FBSDKGraphRequest doesn't return email , Facebook login fails (always isCancelled) after upgrading to SDK 4.1 I have upgraded Facebook SDK from 3.21.1 to 4.1 in an iOS app (already live). I followed� Android Facebook sdk override login button. android,eclipse,facebook,login,facebook-sdk-4.0. Put 1 Facebook Login button in Activity1 and 1 in Activity2. They both will use same access token and other things to detect current login state. Then, You can hide the Button from Activity1 if successfully logged in and do opposite in Activity2.

Another reason for the call to FBSDKLoginManagerLoginResult to always return isCancelled: if the app (in development) is asking for certain permissions, the user is not a listed developer for this app, and FaceBook has not yet approved the app for these permissions, it will always return isCancelled.

ios, Facebook login fails (always isCancelled) after upgrading to SDK 4.1Add Facebook “name” to PFUser [“fullname”] in swiftFacebook Android� Login Failed. 346 likes. Here you can share the information about what to do if Login to Faceoook Failed

iOS/Swift/FBSDKLoginKit:FBSDKLoginManager()を使用して , Facebook FBSDKLoginManager/logInWithReadPermissions Swift Example not using Facebook login fails (always isCancelled) after upgrading to SDK 4.1 Facebook Login for Android failing for some apps. Created by David Doran — June 2, 2016 at 1:44 AM. Current State. Resolved. Description. Facebook Login for Android

Changelog - Unity SDK, Facebook FBSDKLoginManager/logInWithReadPermissions Swift Example not using Parse � Facebook login fails (always isCancelled) after upgrading to SDK� I have c# code that I use to upload files to ESXi 4.0. The exact same code fails after upgrade to 4.1. I get this error: "This request requires

iOS / Swift / FBSDKLoginKit:使用FBSDKLoginManager()登录 , Changelog. List of changes and fixes to the Facebook SDK for Unity. Modified: Update to Audience Network SDK for Android/iOS SDK 5.1.0 NPE on Android when Unity activity was killed during login flow Issue where custom app events would fail fail to fire Will always call the login callback, even if cancelled. I have also experienced this failure repeatedly, both with version 1803 and again with version 1809. I have tried numerous suggested answers, all of which have failed with identical results. I contacted Microsoft tech support and after a long session, they gave up and told me i needed to do a clean install of Windows 10.

Comments
  • try this stackoverflow.com/a/29365852/3141464
  • I am getting this issue for iOS-8 only iOS-9 working fine . Have you any idea ?
  • @iThink: Please note that iOS 8 using another function in AppDelegate. It is func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool