Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

IOS: facebook login show browser and native at the same time #785

Open
vongkeo opened this issue Aug 3, 2020 · 10 comments
Open

IOS: facebook login show browser and native at the same time #785

vongkeo opened this issue Aug 3, 2020 · 10 comments

Comments

@vongkeo
Copy link

vongkeo commented Aug 3, 2020

Hello there,
I have a problem with facebook LoginManager with "web_only" behavior but the result is when i click FB login button it show webview first after that there is a popup alert say "open this page in facebook app" continuously, And when i click on "open" option the native "Login with facebook" screen appear and last when i click on continues with the account in facebook app it go back to facebook login webview page in my application. So we are not getting response from facebook sdk.

Please do reply ASAP
Thanks,
IMG_5525
IMG_5526
IMG_5527
IMG_5528

@GalushkoVasiliy
Copy link

Same issue

@Poojapandey89
Copy link

Having the same issue, please reply ASAP.

@prih
Copy link

prih commented Aug 21, 2020

just follow the documentation, i think the problem with this:

AppDelegate.m

#import <FBSDKCoreKit/FBSDKCoreKit.h>
- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [[FBSDKApplicationDelegate sharedInstance]application:app
                                                       openURL:url
                                                       options:options];
}

https://developers.facebook.com/docs/ios/use-cocoapods
https://github.com/facebook/react-native-fbsdk/blob/master/example/ios/RNFBSDKExample/AppDelegate.m

@Poojapandey89
Copy link

@prih The AppDelegate.m implementation is same. The issue is with iOS version 13 and above. Is there any new integration to be done for iOS 13 and above?

@prih
Copy link

prih commented Aug 25, 2020

@Poojapandey89 tested this on 13.6.1 everything is ok, after change AppDelegate.m

@JeyShah
Copy link

JeyShah commented Sep 21, 2020

@Poojapandey89 Anyone got solution for this?

@Poojapandey89
Copy link

@JeyShah Updated the AppDelegated.m File with-
AppDelegate.m

  • (BOOL)application:(UIApplication *)app
    openURL:(NSURL *)url
    options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
    {
    return [[FBSDKApplicationDelegate sharedInstance]application:app
    openURL:url
    options:options];
    }

@HerbertLim
Copy link

I think the following code, mentioned by @prih and @Poojapandey89, is missing or not updated in iOS Quick Start documentation.

// Code A
- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [[FBSDKApplicationDelegate sharedInstance]application:app
                                                       openURL:url
                                                       options:options];
}

Quick start requests to include the following code, which is different from the above code(Code A):

// Code B
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                         openURL:url
                                               sourceApplication:sourceApplication
                                                      annotation:annotation];
}

Now Xcode 12.2 shows the method(Code B) in Quick Start is deprecated, as shown below:
image

I added Code A to my AppDelegate.m and now facebook login completes normally.
Thanks @prih and @Poojapandey89 .

By the way, my method definition was slightly different:

- (BOOL)application:(UIApplication *)application
   openURL:(NSURL *)url
   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
}

I replaced return [RCTLinkingManager application:application openURL:url options:options];
with

  return [[FBSDKApplicationDelegate sharedInstance]application:application
                                                       openURL:url
                                                       options:options];

@platoonic
Copy link

Any updates for this issue? I've used @prih and @Poojapandey89 codes and it's still not working, stuck at the webview after logging in on FB app.

@aguscha333
Copy link

@HerbertLim thank you so much for your answer, my case was exactly that. I had the deprecated warning and was implementing the new method but for other linking related stuff so I had to merge what I had with this facebook bit on the new method and it worked like a charm!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants