2014-04-28 55 views
1

我設法使用Facebook登錄到我的應用程序。但是當我嘗試使用下面的代碼寫在我的牆上時。我得到錯誤代碼191.發佈在臉書牆上; FB錯誤191 - 使用Facebook連接插件

該應用程序是用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] 

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

}); 
+0

這是否在phonegap構建之外工作? (基本的Javascript)。很高興看到你的FB.init()檢查channelURL和AppId,例如 – jedison

+0

還沒有嘗試過。只是在應用程序 –

+0

好吧,我編輯併發布了fb.init –

回答

2

你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> 

嘗試添加版本參數。

+0

不,不應該 - 「channelUrl」不再使用。 – CBroe

+0

我已經試過了,它仍然帶來了錯誤 –

+0

你確定這是正確的URL:'https:// spinapp.spingroup.co.ug /'?當我嘗試訪問它時,出現SSL錯誤。你應該打電話給SpinApp沒有servlet嗎? – jedison

相關問題