Facebook-ios-sdk: LoginManager() callback doesn't call with Facebook App installed

Created on 22 Oct 2019  路  5Comments  路  Source: facebook/facebook-ios-sdk

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Xcode Version: 11.0.0
  • Swift Version: 5.0 (if issue is Swift related)
  • Installation Platform & Verison: [Cocoapods] version 1.6.1

Goals

Login with Facebook when Facebook app is installed

Expected Results

LoginManager() callback is called with the login result

Actual Results

When Facebook app is installed, LoginManager() callback is not called. When the app is not installed and the browser is used, it works.

Steps to Reproduce

Install the latest version of Facebook SDK and try to call LoginManager().logIn function with Facebook app installed.

Code Samples & Details

Please provide a code sample, as well as any additional details, to help us track down the issue. If you can provide a link to a test project that allows us to reproduce the issue, this helps us immensely in both the speed and quality of the fix.

Note: Remember to format your code for readability:

let loginManager = LoginManager()
        loginManager.logIn(permissions: [.publicProfile, .email], viewController: self, completion: { loginResult in
            switch loginResult {
            case .failed(let error):
                print("\(error)")
            case .cancelled:
                print("cancelled")
            case .success(let grantedPermissions, let declinedPermissions, let accessToken):
                print("\(grantedPermissions) \(declinedPermissions)")
            }
})

Most helpful comment

I encountered the same problem

But updating to the latest version is still not resolved

Installing FacebookCore (0.9.0)
Installing FacebookLogin (0.9.0)
Xcode (11.2.1)

If you're using Scene pattern, you have to add this code in SceneDelegate.swift

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        guard let url = URLContexts.first?.url else {
            return
        }
        let _ = ApplicationDelegate.shared.application(
            UIApplication.shared,
            open: url,
            sourceApplication: nil,
            annotation: [UIApplication.OpenURLOptionsKey.annotation])
 }

Importing FBSDKCoreKit as well

All 5 comments

@luciano88 Did you manage to solve this?

@luciano88 Did you manage to solve this?

Yes, I solved updating to the new pods

I encountered the same problem

But updating to the latest version is still not resolved

Installing FacebookCore (0.9.0)
Installing FacebookLogin (0.9.0)
Xcode (11.2.1)

I encountered the same problem

But updating to the latest version is still not resolved

Installing FacebookCore (0.9.0)
Installing FacebookLogin (0.9.0)
Xcode (11.2.1)

If you're using Scene pattern, you have to add this code in SceneDelegate.swift

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        guard let url = URLContexts.first?.url else {
            return
        }
        let _ = ApplicationDelegate.shared.application(
            UIApplication.shared,
            open: url,
            sourceApplication: nil,
            annotation: [UIApplication.OpenURLOptionsKey.annotation])
 }

Importing FBSDKCoreKit as well

I encountered the same problem
But updating to the latest version is still not resolved
Installing FacebookCore (0.9.0)
Installing FacebookLogin (0.9.0)
Xcode (11.2.1)

If you're using Scene pattern, you have to add this code in SceneDelegate.swift

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        guard let url = URLContexts.first?.url else {
            return
        }
        let _ = ApplicationDelegate.shared.application(
            UIApplication.shared,
            open: url,
            sourceApplication: nil,
            annotation: [UIApplication.OpenURLOptionsKey.annotation])
 }

Importing FBSDKCoreKit as well

It's working, thank you very much

Was this page helpful?
0 / 5 - 0 ratings