我们正在尝试整合Wizcorp PhoneGap facebook插件(https://github.com/Wizcorp/phonegap-facebook-plugin)以支持新的Ionic应用程序中的登录过程。
使用Facebook登录似乎对新用户来说效果很好。问题是当用户注销并尝试重新登录时他会收到错误:
Facebook错误:会话已关闭且未正常关闭
我们在这里做错了什么?
这是我们现在正在使用的代码:
function fbLogin() {
facebookConnectPlugin.login(['email'], function (response) {
alert("Login Successfull");
alert(JSON.stringify(response));
}, function (error) {
alert("Login ERROR");
alert(JSON.stringify(error));
})
}
function getDetails() {
facebookConnectPlugin.getLoginStatus(function (response) {
if (response.status === 'connected') {
alert("You're connected!");
var userID = response.authResponse.userID;
facebookConnectPlugin.api('/' + response.authResponse.userID + '?fields=id,name,picture.width(400).height(400)', [], function (result) {
alert(JSON.stringify(result));
})
} else if (response.status === 'not_authorized') {
alert("Not Autherized!");
} else {
alert("You're not loggin into Facebook!");
}
});
}
function fbLogout() {
facebookConnectPlugin.logout(function (response) {
alert("Logout success");
alert(JSON.stringify(response));
}, function (error) {
alert("Logout ERROR");
alert(JSON.stringify(error));
})
}
我们已检查此链接:
然而,当我们尝试实现以下代码时 - 我们收到错误
Tyeperror cordova.getActivity不是函数
PackageInfo info = cordova.getActivity().getPackageManager().getPackageInfo("com.goapes.golearn", PackageManager.GET_SIGNATURES);
以上链接告诉我们在Facebook App Dashboard中需要另一个Hash Key,那么有另一种获取此Hash的方法吗?