facebook login manager throws Error: Login Failed

冷暖自知 提交于 2019-12-09 23:58:12

问题


Using the code sample from their github page -

LoginManager.logInWithReadPermissions(["public_profile"]).then(
      (result) => {
        if (result.isCancelled) {
          console.log("Login cancelled");
        } else {
          console.log(
            "Login success with permissions: " +
              result.grantedPermissions.toString()
          );
        }
      },
      error => {
        console.log("Login fail with error: " + error);
      }
    );

This runs perfectly fine on android but does nothing in ios. I tried LoginManager.logOut() without success. I have double checked my info.plist details. Can't seem to figure out why login fails.


回答1:


The latest 4.39 version seems to be buggy. I got around it by downgrading all facebook related pods to 4.38.0.

My pod file looks like this -

  pod 'FacebookSDK', '~> 4.38.0'
  pod 'FBSDKShareKit', '~> 4.38.0'
  pod 'FBSDKCoreKit', '~> 4.38.0'
  pod 'FBSDKLoginKit', '~> 4.38.0'



回答2:


Just set the setLoginBehavior(Platform.OS === 'ios' ? 'browser : 'native_with_fallback');

It will create the webView if there will be no facebook app installed in your phone for android.



来源:https://stackoverflow.com/questions/53704024/facebook-login-manager-throws-error-login-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!