本文介绍了Facebook应用程序:将fb.api方法发布在朋友的墙上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过FB.API方法在朋友墙上张贴。对我来说不行我冲浪了很多他们中的一些人告诉他们已经被弃用了。有关这个问题的Facebook官方信息吗?请帮我认识谢谢。

I have tried FB.API method to post on friends wall. It is not working for me. I have surfed a lot. Some of them told that was deprecated. Is there any official information from Facebook regarding this issue? Please help me to know. Thanks.

供您参考,

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


推荐答案

截至2013年2月6日,您不能通过 FB.API 方法发布到Friends Timeline。

阅读这里:

As of February 6, 2013, you can't post to Friends Timeline with FB.API method.
Read Here: https://developers.facebook.com/roadmap/completed-changes/

寻找 Feed对话框 Open Graph Actions 作为替代方案。

Feed对话框示例:

Look for feed Dialog or Open Graph Actions as alternative.
Example with Feed Dialog:

function postToFriend() {

    // calling the API ...
    var obj = {
      method: 'feed',
      to: 'friend_id',
      link: 'http://www.facebook.com/thepcwizardblog',
      picture: 'http://fbrell.com/f8.jpg',
      name: 'Feed Dialog',
      caption: 'Tagging Friends',
      description: 'Using Dialogs for posting to friends timeline.'
    };

    function callback(response) {
      document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
    }

    FB.ui(obj, callback);
  }

Facebook对话框的完整文档:

Complete Documentation for Facebook Dialog: https://developers.facebook.com/docs/reference/dialogs/feed/

这篇关于Facebook应用程序:将fb.api方法发布在朋友的墙上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 12:20