Facebook Connect /phonegap - “nativeInterface” FB.init 调用中的参数,它的作用是什么?
所以我一直在尝试为 PhoneGap / Android 运行 Facebook Connect 示例,但没有成功。 https://github.com/davejohnson/phonegap-plugin-facebook-connect *
有一些类似的线程有同样的问题.. 结论是“Facebook SDK 是一个移动点”
我已经成功地使用phoneGap 和 编译了以前的应用程序。蚀。 现在按照 Android 的示例*进行操作。如果我完全按照他们的建议去做。应用程序显示按钮,但当我单击它们时没有任何反应。
分析代码后,我注意到
function initFB(){
try {
FB.init({ appId: "45253452345234523", nativeInterface: PG.FB });
document.getElementById('data').innerHTML = "";
} catch (e) {
alert(e);
}
}
有一个参数 nativeInterface : PG.FB 在 Facebook API 中没有对此调用进行描述。 http://developers.facebook.com/docs/reference/javascript/FB。 init/
更有趣的是,当我删除这个参数时..突然登录按钮转到 Facebook 页面,错误代码 API 191。
所以我的问题是这个参数应该做什么?为什么它不在 Facebook API 中?
我在互联网上没有找到有关此参数的信息。我想如果这是一个过时的 FB API 的情况,会有一些可用的信息。
有什么想法吗?
谢谢,
马尔辛
So I have been trying to run the Facebook Connect example for PhoneGap / Android with no luck.
https://github.com/davejohnson/phonegap-plugin-facebook-connect *
There are some similar threads with the same problem.. conclusion is that "Facebook SDK is a moving point"
I have succesfully compiled previously apps using phoneGap & Eclipse.
Now following the example* for Android. If I do exactly what they suggest. App shows the buttons but nothing happens when I click on them.
After analyzing the code I have noticed that
function initFB(){
try {
FB.init({ appId: "45253452345234523", nativeInterface: PG.FB });
document.getElementById('data').innerHTML = "";
} catch (e) {
alert(e);
}
}
there is a parameter nativeInterface : PG.FB which is nowhere described within Facebook API for this call..
http://developers.facebook.com/docs/reference/javascript/FB.init/
what is more interesting is that when i remove this parameter.. suddenly Login button goes to Facebook page with Error Code API 191.
So my question is what this parameter is supposed to do? and why it is not in Facebook API?
I have found no info about this parameter in internet. I guess if it would be a case of an out-dated FB API there would be some info available.
Any ideas?
Thanks,
Marcin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“nativeInterface: PG.FB”选项是告诉 PhoneGap 使用本机身份验证界面而不是移动 Web 界面。如果您不添加“PG.FB”选项,您将被重定向到 Facebook 的移动身份验证。我也花了一段时间才弄清楚这一点,而且没有很好的记录,但这就是正在发生的事情。
关于 PhoneGap Facebook 插件的另外两件事与最新的 Facebook JavaScript SDK 不同步:
希望他们能够更新 PhoneGap Facebook 插件,但现在我使用 if/else 语句来检测 PhoneGap 是否存在。您可以使用以下命令检查 PhoneGap 是否已初始化:
if(window.PhoneGap) {
//PhoneGap库已加载
}
The "nativeInterface: PG.FB" option is to tell PhoneGap to use the native authentication interface instead of the mobile web interface. If you don't add in the "PG.FB" option, you'll get redirected to Facebook's mobile authentication instead. It took me a while to figure this out too, and it's not well documented, but that's what is going on.
Two other things about the PhoneGap Facebook Plugin that are not up to date with the latest Facebook JavaScript SDK:
Hopefully they'll get to updating the PhoneGap Facebook Plugin, but for now I use if/else statements to detect if PhoneGap is there. You can check if PhoneGap is initialized by using:
if(window.PhoneGap) {
//PhoneGap Library is Loaded
}