React-native-fbsdk: Some devices stuck on "Log in with the Facebook app" screen

Created on 10 Feb 2019  路  10Comments  路  Source: facebook/react-native-fbsdk

On some devices, after successfully logging in, users are redirected back to this screen, and cannot return back into the app. Has anyone seen this behavior and can point me in the right direction? I'm thinking I might have misconfigured something.. but it's difficult to tell.

image

Most helpful comment

Also getting this issue. We are using 0.8.0

Edit:
This issue no longer occurs for us if we install from the latest master in this repo.

All 10 comments

We're getting this issue also. If the user logs in via the FB app, this happens. If they log in using the built-in browser, it works.

We're currently using version 0.7.0 and trying to upgrade but getting errors.

Also getting this issue. We are using 0.8.0

Edit:
This issue no longer occurs for us if we install from the latest master in this repo.

Confirmed @econner 's solution worked for us!

Edit: used commit 4fe3dbbb4e2bd955d2cd447d94264d80ffd0eaea

@econner @acoulon99 even with '4fe3dbbb4e2bd955d2cd447d94264d80ffd0eaea' this issue still occurs for us.
Please, I'll really appreciate if you tell me

  1. Did you do something else except upgrading the version
  2. Do you use cocoa pods or the downloaded FacebookSDK

Thanks a lot! :)

Hey @dbelchev ,
All I did was upgrade the version. I am using cocoa pods with fbsdk 4.40.0

10x a lot @econner!!!
Actually I was able to fix the problem even on [email protected] with cocoa pods by tweaking the FBSDK delegate in my AppDelegate.m - a lot off stuff in 'openURL':

- (BOOL)application:(UIApplication *)app 
            openURL:(NSURL *)url 
            options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {

if(![RNBranch.branch application:application openURL:url options:options]) {
        BOOL handledFacebook = [[FBSDKApplicationDelegate sharedInstance] application:application
                                                                              openURL:url
                                                                    sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                                           annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
                                ];
        BOOL shouldOpenUrlForAppAuth = [_currentSession resumeAuthorizationFlowWithURL:url];
        BOOL shouldOpenUrl = [RCTLinkingManager application:application openURL:url options:options];

        _currentSession = nil;

        return handledFacebook || shouldOpenUrlForAppAuth || shouldOpenUrl;
    }

    return YES;
}

Ditto @dbelchev , I also fixed my problem by tweaking AppDelegate.m and openURL!

@dbelchev What is _currentSession in your code?

Ditto @dbelchev , I also fixed my problem by tweaking AppDelegate.m and openURL!

how did you fix?

Any one having the same issue yet? my fbsdk version is 1.1.2 and my appdelegate.m is:

/**

  • Copyright (c) Facebook, Inc. and its affiliates.
    *
  • This source code is licensed under the MIT license found in the
  • LICENSE file in the root directory of this source tree.
    */

import "AppDelegate.h"

import

import

import "RNFirebaseNotifications.h"

import "RNFirebaseMessaging.h"

import "RNSplashScreen.h"

import

import

import

import

import

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    [RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES]; // <-- add this
    RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
    RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
    moduleName:@"Rosate"
    initialProperties:nil];

    [FIRApp configure];
    [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
    [RNFirebaseNotifications configure];

    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    UIViewController *rootViewController = [UIViewController new];
    rootViewController.view = rootView;
    self.window.rootViewController = rootViewController;
    [self.window makeKeyAndVisible];
    [RNSplashScreen show]; // here
    return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
    }

  • (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
    {

    if DEBUG

    return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

    else

    return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

    endif

}

  • (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
    fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
    [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
    }

  • (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
    [[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
    }

  • (void)application:(UIApplication)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData)deviceToken
    {

}

-(void) userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {

[[RNFirebaseMessaging instance] didReceiveRemoteNotification:response.notification.request.content.userInfo];
completionHandler();
}

  • (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
    if (![RNBranch.branch application:app openURL:url options:options]) {
    // do other deep link routing for the Facebook SDK, Pinterest SDK, etc
    return YES;
    }
    if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
    return YES;
    }
    return NO;
    }

  • (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
    return [RNBranch continueUserActivity:userActivity];
    }

// Facebook SDK

  • (void)applicationDidBecomeActive:(UIApplication *)application {
    [FBSDKAppEvents activateApp];
    }

// Initialize the Branch Session at the top of existing

@end

Was this page helpful?
0 / 5 - 0 ratings