我试图让我的应用程序的用户通知多个 Facebook 朋友他们需要他们在网页上为他们最喜欢的项目投票。我一直在使用 FB 发送方法(https://developers.facebook.com/docs/reference/dialogs/send/)并且它在桌面上运行良好(代码如下)但我刚刚意识到我忽略了它的位置在文档中说此对话框“在移动设备上不受支持”。
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);
}
}); }