gpt4 book ai didi

javascript - 在 Facebook 墙上张贴; fb 错误 191 - 使用 facebook 连接插件

转载 作者:行者123 更新时间:2023-11-30 17:29:56 26 4
gpt4 key购买 nike

我已成功使用 Facebook 登录到我的应用程序。但是当我尝试使用下面的代码在我的墙上写字时。我收到错误代码 191。

该应用程序是使用 phonegap build 制作的。

    ![function facebookWallPost() {
console.log('Debug 1');
var params = {
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
};
//alert.log(params);
FB.ui(params, function(obj) { alert.log(obj);});
}][1]

facebook error

if (typeof CDV === 'undefined') {
alert('CDV variable does not exist. Check that you have included cdv-plugin-fb-connect.js correctly');
}
if (typeof FB === 'undefined') {
alert('FB variable does not exist. Check that you have included the Facebook JS SDK file.');
}
FB.Event.subscribe('auth.login', function(response) {
alert('auth.login event');
});

FB.Event.subscribe('auth.logout', function(response) {
alert('auth.logout event');
});

FB.Event.subscribe('auth.sessionChange', function(response) {
alert('auth.sessionChange event');
});

FB.Event.subscribe('auth.statusChange', function(response) {
alert('auth.statusChange event');
});
try {
FB.init({
appId: "134641180044214",
nativeInterface: CDV.FB,
useCachedDialogs: false
});
} catch (e) {
alert(e);
}

facebook app settings

var loginButton = $('#fb_login');

loginButton.on('click', function(e) {
e.preventDefault();

FB.login(function(response) {
if (response.status === 'connected') {
alert('logged in');
FB.api('/me', user_info_callback);
} else {
alert('not logged in');
}
},{ scope: 'basic_info'});

});

最佳答案

您的 FB.init() 似乎缺少一些参数:

<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{your-app-id}',
xfbml : true,
version : 'v2.0'
});
};

(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>

尝试添加版本参数。

关于javascript - 在 Facebook 墙上张贴; fb 错误 191 - 使用 facebook 连接插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23340145/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com