Facebook-ios-sdk: Facebook login swift, stuck with “Open this page in Facebook” dialog

Created on 14 Jul 2020  ·  12Comments  ·  Source: facebook/facebook-ios-sdk

I using Facebook Log In, and Firebase, with swift. Latest xcode and pods.

My ViewController uses LoginButtonDelegate.

Here is some of the code in the ViewController:

func loginButton(_ loginButton: FBLoginButton, didCompleteWith result: LoginManagerLoginResult?, error: Error?) {

print("2124: didCompleteWith. result \(result.debugDescription)")

if let error = error {
    print("2124: didCompleteWith. Error \(error.localizedDescription)")
    return
}
print("2124: Successful Facebook login: result: \(result.debugDescription)")


if result?.isCancelled ?? false {
          print("2124: Cancelled")
      } else if error != nil {
          print("2124: ERROR: Trying to get login results")
      } else {
          print("2124: Logged in")
            let credential = FacebookAuthProvider.credential(withAccessToken: AccessToken.current!.tokenString)
                    firebaseFaceBookLogin(credential: credential)
      }

}
The problem this, when I click on the facebook log in icon, I get the message that the app wants to use facebook.com to sign in. I press continue. It opens up a new page, (like brouser) and asks, "Open this page in "Facebook", but then its stuck. I cannot click cancel or open in the dialog. I have to click cancel in the top left, and then I'm never able to log in.

Here is a screenshot of where things go wrong...

image

NOTE: When I uninstalled the facebook app it works.

Thanks!

All 12 comments

I have the same exact issue, it doesn't go anywhere. only the cancel button works at the top left. when you click open in the dialog attached in the screenshot, it directs you back to the basic page where it says that you've previously logged in, then the same dialog prompts again and the cycle continues

Hi @bermanapps, thank you for reporting this issue! Could you please provide the app name?

Hi, the app is called Tap & Learn, however the currently published version has no issue, since I didn't use any login. I'm designing a new version of the app with log in for Firebase with Facebook, and its happening on my debugging. Does this help you?

@bermanapps Thank for the reply. We are working on getting this issue resolved. In the mean time, I've disabled app switching for you app (which means that you will not get the “Open this page in Facebook” dialog) so that you would be able to complete the login process.

Thanks. So in the meantime users cannot log in with Facebook till you fix it? Thanks

@bermanapps They would be able to login in the web view, but they would not be able to login using the facebook app.

Same issue here. Only top left cancel button was working.
I solved the issue going to the Settings on my phone > Safari > Clean history and cache data

Same issue with pod install newest SDK 7.1.1

This issue is the same as #1067
I think it is related to URL handling.

If you are using SceneDelegate, you can check this post. https://github.com/facebook/facebook-ios-sdk/issues/1067#issuecomment-559629930

New SwiftUI project with SwiftUI App life cycle from Xcode 12 handle URL callbacks in onOpenURL(perform:) view modifier.
https://developer.apple.com/forums/thread/651234?login=true

And I don't know how to handle the URL callback to make Facebook native app login work.

I found a solution to handle the URL in SwiftUI App life cycle.

ContentView().onOpenURL { (url) in guard let urlScheme = url.scheme else { return } if urlScheme.hasPrefix("fb") { ApplicationDelegate.shared.application(UIApplication.shared, open: url, sourceApplication: nil, annotation: UIApplication.OpenURLOptionsKey.annotation) } }

reference: https://youtu.be/l9hY7vyw1bw?t=152

@bermanapps Thank for the reply. We are working on getting this issue resolved. In the mean time, I've disabled app switching for you app (which means that you will not get the “Open this page in Facebook” dialog) so that you would be able to complete the login process.

How do I disable app switching because I have the same problem

If you have similar problem, please report a bug at https://developers.facebook.com/support/bugs/, an engineer will be able to help you. @beginner-lang

Was this page helpful?
0 / 5 - 0 ratings