facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

[iOS] Facebook Login opens and closes right away #694

Open edo1493 opened 4 years ago

edo1493 commented 4 years ago

🐛 Bug Report

I have react-native-fbsdk (1.1.1) on my react native (0.61.5) app.

I am using LoginManager to open the login view and implement facebook login. Everything is working fine, but every now and then I can see that the window opens for a millisecond and closes right away.

I have done a bit of digging and I can see:

[[FBSDKApplicationDelegate sharedInstance] application: app openURL:url options:options]

returning false in openURL (when the fb view is opening) and so my method goes into:

[RCTLinkingManager application: app openURL:url options:options]

and returns YES. This is when the window closes right away.

There are no errors from the SDK or anything I can trace it back to.

To Reproduce

This is a very intermittent issue and apart from trying 5-10 times in a row, I can't figure out a way to consistently reproduce it.

Expected Behavior

The window shouldn't close and the login flow should complete.

Code Example

I thought this was an issue related to my openURL method, which I am adding here as well:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if (![RNBranch.branch application: app openURL:url options:options]) {
      if ([[FBSDKApplicationDelegate sharedInstance] application: app openURL:url options:options]) {
        return YES;
      }
      if ([RCTLinkingManager application: app openURL:url options:options]) {
        return YES;
      }
      return NO;
    }
    return YES;
}

Environment

System: OS: macOS Mojave 10.14.6 CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz Memory: 41.14 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.11.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: API Levels: 18, 23, 25, 26, 27, 28 Build Tools: 27.0.3, 28.0.1, 28.0.2, 28.0.3 System Images: android-18 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.5429.30.34.5452501 Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild npmPackages: react: 16.10.2 => 16.10.2 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7

Mcebrera commented 4 years ago

Having the same issue. Surprisingly this is not occurring locally for us but on test flight, beta, and production the FB button goes to an isCanceled = true and users can't use functionality. Any help on this?

laterum commented 4 years ago

Same here. But we've discovered that this issue doesn't come up on our older iPhone 6, while it does appear on iPhone 8 and iPhone X that we have. Could it be due to the difference in ios versions? Because iPhone 6 is forever stuck on ios 12 and we've updated the rest to ios 13.

numandev1 commented 4 years ago

same issue