问题
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