【问题标题】:Posting on facebook wall; fb error 191 - using facebook connect plugin在脸书墙上发帖; fb 错误 191 - 使用 facebook 连接插件
【发布时间】:2014-04-28 11:41:41
【问题描述】:

我已经设法使用 facebook 登录到我的应用程序。但是当我尝试使用下面的代码在墙上写字时。我得到错误代码 191。

该应用是使用 phonegap 构建的。

    ![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]

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

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

});

【问题讨论】:

  • 这在 phonegap 构建之外是否有效? (基本 Javascript)。最好看看你的 FB.init() 来检查 channelURL 和 AppId,例如
  • 没试过。就在应用内
  • 好的,我编辑并发布了 fb.init

标签: javascript facebook phonegap-build


【解决方案1】:

您的 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>

尝试添加版本参数。

【讨论】:

  • 不,不应该——channelUrl 不再使用了。
  • 您确定这是正确的 URL:https://spinapp.spingroup.co.ug/?当我尝试访问它时,我收到一个 SSL 错误。 SpinApp 中没有您应该调用的 servlet?
  • 没有https,只有http
  • 检查我们的 FB.init() 是否传递了 v2 所需的(新)参数。
  • 好的。但我收到了这条信息。发生错误。请稍后再试
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多