Facebook FB.ui发送方法不适用于移动网络,需要替代方案

时间:2014-03-10 23:37:47

标签: facebook facebook-graph-api fb.ui facebook-messages fbwebdialogs

我正在尝试允许我的应用的用户通知多个Facebook好友他们需要他们在网页上投票选出他们喜欢的项目。我一直在使用FB发送方法(https://developers.facebook.com/docs/reference/dialogs/send/)并且它在桌面上工作正常(代码低于)但我只是意识到我忽略了它在文档中所说的内容对话框“在移动设备上不受支持。”

是否有任何替代方法可以让用户通过移动浏览器向朋友发送私信?也许是一种诱骗api认为它是桌面的方法?

我也愿意使用另一个FB对话框,只要它:1)从移动浏览器起作用2)允许预先填充收件人3)在发件人和收件人之间是私密的,如私人消息或通知。

任何想法都会非常感激。感谢

FB发送方法代码:

function resetSelector(){
 $('#fs-user-list').empty();

 $(".mutual-friends-link").fSelector({

max: 5,
excludeIds: exclusions,
facebookInvite: false,
lang: {
  title: "Pick your mutual friends who will vote on the gifts (Last step)",
  buttonSubmit: "Add Accomplices",
  selectedLimitResult: "Limit is {5} people."
},
closeOnSubmit: true,
onSubmit: function(response){
  var accompliceUid;
  accomplices = response;
  $('#index-accomplices').empty()
  var i = 0

  var FB_notification = function(accomplice, poll_id){
    FB.api('https://graph.facebook.com/', 'post', {
        id: "http://giftadvisor.herokuapp.com/polls/" + poll_id,
        scrape: true
      }, function(response){
        FB.ui({
        method: 'send',
        to: [accomplice],
        link: "http://giftadvisor.herokuapp.com/polls/" + poll_id,  
        }, fbCallback)
      })
    }

  var fbCallback = function(){
    console.log(i++)
    if (i === accomplices.length){
      window.location = "/polls/" + poll.id
    }
  }
    _.each(accomplices, function(accomplice){
      $('#index-accomplices').append('<img class="accomplices" src="http://graph.facebook.com/' + accomplice + '/picture?type=large">');

      user = new User({uid: accomplice});
      user.save(null,
        {success: function(response){
          console.log("users saved")
          console.log(response.attributes.uid);
          vote = new Vote();
          vote.save({
            user_id: response.attributes.id, 
            poll_id: poll.id, 
            image_url: "http://graph.facebook.com/" + response.attributes.uid + "/picture"
            },{success: function(response){
              FB_notification(accomplice, poll.id);
            } 
         }
        );
        }});
    });
  // }});

},
onClose: function(){

  // FB_notification(accomplices, poll.id);
}

}); }

1 个答案:

答案 0 :(得分:1)

我唯一看到的就是使用现已弃用的聊天API。例如,请参阅what Grouper does

发送对话框确实是我想要的,但移动网络上的失败使它变得毫无用处。您是否找到了其他可行的方法?