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

logInWithPermissions Promise not being resolved #608

Closed
eran-pinhas opened this issue Jul 28, 2019 · 22 comments
Closed

logInWithPermissions Promise not being resolved #608

eran-pinhas opened this issue Jul 28, 2019 · 22 comments

Comments

@eran-pinhas
Copy link

eran-pinhas commented Jul 28, 2019

Hi,

In android - the promise returned from the logInWithPermissions function seems to be ok but it's not resolved (nor rejected...) after successful login. same issue when using the <LoginButton /> callbacks are not being called back.

What am I missing? anyone seen that behavior before?

  try {
    const result = await LoginManager.logInWithPermissions(["public_profile", "email", "user_friends"]);
    console.log(result);
  } catch (err) {
    console.log(err);
  }

FYI: it seems that this package is not well supported. Issues are not being closed (~20% open issues) and not all functions are documented. I really think facebook can do a tiny bit better

Thanks y'all

@Subiyel
Copy link

Subiyel commented Jul 29, 2019

Same issue, any ideas

@dsgithub2018
Copy link

dsgithub2018 commented Jul 29, 2019

Hi, I am not able to setup react-native-fbsdk in IOS whereas it is working fine in ANDROID. I am using react-native 0.60.4 and in my package.json I have mentioned, "react-native-fbsdk": "git+https://github.com/facebook/react-native-fbsdk.git" and my pod file is like,

pod 'FBSDKCoreKit', '~> 5.0'

pod 'FBSDKLoginKit', '~> 5.0'

pod 'FBSDKShareKit', '~> 5.0'

But I am always getting the below error after each successful build in IOS,
TypeError: Cannot read property 'logInWithPermissions' of undefined

I am using LoginManager.logInWithPermissions(["public_profile", "email"]) in my code. I am not able to fix this issue from NEW REACT-NATIVE 0.60.0, now the latest version is 0.60.4, but still the same issue! Please help me to fix this issue.

@aanah0
Copy link

aanah0 commented Jul 29, 2019

same issue

@aanah0
Copy link

aanah0 commented Jul 30, 2019

I resolve issue for me.

check is implement this method in your MainActivity

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
    }

@smooJitter
Copy link

@aanah0 where did you download the FB SDK 5.0 from

@dsgithub2018
Copy link

I resolve issue for me.

check is implement this method in your MainActivity

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
    }

My issue is in IOS, not in Android. Would you please give any idea for IOS?

@Subiyel
Copy link

Subiyel commented Aug 1, 2019

i also had same issue with IOS, resolved it by downgrading version to:
pod 'FBSDKCoreKit', ~> 4.40.0'
pod 'FBSDKLoginKit', ~> 4.40.0'
pod 'FBSDKShareKit', ~> 4.40.0'
and using logInWithReadPermissions

i am using RN 58.4

@dsgithub2018
Copy link

dsgithub2018 commented Aug 2, 2019

I have found the following line in react-native-fbsdk(latest)->js->FBLoginManager.js,
const LoginManager = require('react-native').NativeModules.FBLoginManager;

But when I console the require('react-native'), I saw there is no FBLoginManager in NativeModules. I think that's why I am always getting the error like, LoginManager undefined. But FBLoginManager is available when I console the same in Android! Can anybody fix this issue?

@dsgithub2018
Copy link

Any fix?

@dsgithub2018
Copy link

dsgithub2018 commented Aug 9, 2019

I have found the following line in react-native-fbsdk(latest)->js->FBLoginManager.js,
const LoginManager = require('react-native').NativeModules.FBLoginManager;

But when I console the require('react-native'), I saw there is no FBLoginManager in NativeModules. I think that's why I am always getting the error like, LoginManager undefined. Can anybody fix this issue?

Where is the exact issue then? The issue is in react-native or react-native-fbsdk? The same thing is working fine in Android! Actually I am not sure if anything wrong in my end, so can anybody give me the steps to integrate a successful facebook login in react-native(in IOS only)?

@gidox
Copy link

gidox commented Aug 11, 2019

i have the same issue on android

@vivekkadu
Copy link

any solution ?? i am facing same issue ..

@ponchautf
Copy link

I got the same issue on Android but it's working fine on iOS.
and my main activity implement the onActivityResult (solution proposed by dsgithub2018 does not help)

@gidox
Copy link

gidox commented Aug 14, 2019

i resolved this with onActivityResult solution + adding "implementation 'com.facebook.android:facebook-login:[5,6)'" in build.gradlew (dependencies

@kentrh
Copy link

kentrh commented Aug 23, 2019

I solved it by upgrading from v0.10.1 to v1.0.1. Remember to remove all the CallbackManager stuff in MainApplication.java

@janicduplessis
Copy link
Contributor

We have a fix for some callbacks not getting called on android in v1.0.2, also like mentionned previously make sure to remove all CallbackManager stuff.

@cchamikara
Copy link

I'm not using cocopod but still has this issue

@kentrh
Copy link

kentrh commented Aug 26, 2019

@cchamikara I wasn't using Cocoapods either, but it still fixed it. FBSDK's at version 5.3.0.

@cchamikara
Copy link

@kentrh I did remove frameworks and download them from https://github.com/facebook/facebook-objc-sdk/releases/tag/v5.3.0 and dragged them to frameworks again and tried but still same issue , Am I doing correct thing ?

@kentrh
Copy link

kentrh commented Aug 26, 2019

@cchamikara I guess there's quite some config to be done when not using CocoaPods, so you should follow the instructions at https://github.com/facebook/react-native-fbsdk. Make sure you put your SDK's in ~/Documents/FacebookSDK and that you upgrade the package with yarn upgrade react-native-fbsdk --latest But isn't this really an Android issue? For me it was always working on iOS, but the promise was never returned on Android.

@cchamikara
Copy link

@kentrh yes I did follow all the steps , it is working on Android but not in iOS

@jsmile1994
Copy link

jsmile1994 commented Sep 24, 2019

@cchamikara Did you find the solution for this issue? It works well on Android but with iOS, it built fail with this one:
"Initializing 'FBSDKLoginManagerLoginResult *__strong' with an expression of incompatible type 'void (^)(FBSDKLoginManagerLoginResult *__strong, NSError *__strong)'"

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