facebook login manager throws Error: Login Failed
facebook login manager throws Error: Login Failed
使用他们 github 页面中的代码示例 -
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);
}
);
这在 android 上运行得很好,但在 ios 上什么也不做。我尝试 LoginManager.logOut()
没有成功。
我仔细检查了我的 info.plist
详细信息。似乎无法弄清楚为什么登录失败。
最新的 4.39
版本似乎有问题。我通过将所有与 facebook 相关的 pods 降级为 4.38.0
.
来解决这个问题
我的 pod 文件是这样的 -
pod 'FacebookSDK', '~> 4.38.0'
pod 'FBSDKShareKit', '~> 4.38.0'
pod 'FBSDKCoreKit', '~> 4.38.0'
pod 'FBSDKLoginKit', '~> 4.38.0'
只需设置
setLoginBehavior(Platform.OS === 'ios' ? '浏览器: 'native_with_fallback');
如果 phone 中没有为 android 安装 facebook 应用程序,它将创建 webView。
使用他们 github 页面中的代码示例 -
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);
}
);
这在 android 上运行得很好,但在 ios 上什么也不做。我尝试 LoginManager.logOut()
没有成功。
我仔细检查了我的 info.plist
详细信息。似乎无法弄清楚为什么登录失败。
最新的 4.39
版本似乎有问题。我通过将所有与 facebook 相关的 pods 降级为 4.38.0
.
我的 pod 文件是这样的 -
pod 'FacebookSDK', '~> 4.38.0'
pod 'FBSDKShareKit', '~> 4.38.0'
pod 'FBSDKCoreKit', '~> 4.38.0'
pod 'FBSDKLoginKit', '~> 4.38.0'
只需设置 setLoginBehavior(Platform.OS === 'ios' ? '浏览器: 'native_with_fallback');
如果 phone 中没有为 android 安装 facebook 应用程序,它将创建 webView。