2011-09-08 83 views
0

我需要创建一个按钮以在Face Book墙上提交评论。Sencha Touch和Facebook按钮

我在煎茶触摸,并在我的控制器使用MVC我使用函数作为

facebookComment: function() 
{ 
    --------  
    } 

此功能是当按下一个按钮来调用。 任何机构都可以抛出一些关于如何去做这件事?

回答

0

我使用下面的代码张贴在留言板看它是否对你有用与否

  var postParams = { 
       method: 'stream.publish' 
      , target_id: friend_id 
      , display: 'popup' 
      , message: message 
      , user_message_prompt: "Post message!" 
     } 
     FB.api(postParams, function(response) { 
       if(response.error_code || !response) { 
       to handle error  
       } 
     }); 

或参阅此链接https://developers.facebook.com/docs/reference/rest/stream.publish/

0

哦,首先你应该已经使用Javascript SDK

var body = comment_var; 
FB.api('/me/feed', 'post', { message: body }, function(response) { 
    if (!response || response.error) { 
    alert('Error occured'); 
    } else { 
    alert('Post ID: ' + response.id); 
    } 
}); 

显然,应该照顾的用户登录状态(也许使用方法:然后,只需使用FB.api()方法与message字段设置为您的评论发出HTTP POST请求,当前用户的feed连接FB.getLoginStatus())。