2016-10-21 63 views
1

我們正在嘗試整合Wizcorp PhoneGap facebook插件(https://github.com/Wizcorp/phonegap-facebook-plugin)以支持新Ionic應用程序中的登錄過程。Wizcorp phonegap facebook插件問題

用Facebook登錄似乎對新用戶來說很好。問題是,當用戶簽署並嘗試重新登錄,他得到的錯誤:

Facebook error: Session was closed and not closed normally

什麼是我們錯在這裏做什麼?

這裏,我們使用的是現在的代碼:

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)); 
    }) 
} 

我們已經檢查了此鏈接:

https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/TROUBLESHOOTING.md#no-reply-from-login

然而,當我們試圖實現下面的代碼 - 我們得到一個錯誤

Tyeperror cordova.getActivity is not a function

PackageInfo info = cordova.getActivity().getPackageManager().getPackageInfo("com.goapes.golearn", PackageManager.GET_SIGNATURES); 

上面的鏈接告訴我們,我們需要在我們的Facebook應用程序儀表板中使用另一個哈希鍵,那麼是否有另一種獲得哈希的方法?

回答

0

我覺得你最好試試這個插件。因爲我使用這個插件開發了一個應用程序,現在正在生產。 :) 這裏check this

+0

嗨Shanaka - 插件看起來很有希望,但我們已經找到了另一種解決方案 - 無論如何,感謝您的答覆。 –