【问题标题】:facebook post with image (object_attachment). Image is empty. Why?带有图片的 Facebook 帖子(object_attachment)。图像为空。为什么?
【发布时间】:2014-04-21 22:50:53
【问题描述】:

我必须使用我的应用程序中的图像在 facebook 上创建帖子。
图像存储在应用程序中。

我做什么:

  1. 使用Request.newUploadPhotoRequest将图像上传到用户照片并接收照片ID 来自脸书。例如,我收到"637590962949508"。

  2. 创建帖子并发送到 Facebook:
    Request(session, "me/feed", postParams, HttpMethod.POST, callback)。
    在postParams 我还把postParams.putString("object_attachment", photoId) 放在photoId = "637590962949508"

回复是:

{
  Response:  responseCode: 200,
  graphObject: GraphObject{
    graphObjectClass=GraphObject,
    state={
      "id":"100000958302790_637591166282821"
    }
  },
  error: null,
  isFromCache:false
}

如我所见,Facebook 告诉我一切正常。结果:我可以在我的提要中看到帖子,但图像是空的(空方块)。但图片是存在于照片中的。

哪里出错了?

【问题讨论】:

    标签: android facebook


    【解决方案1】:

    我在 facebook 上遇到了同样的问题。在您的情况下,facebook 无法显示您的图像的缩略图,但是当您单击帖子时,您可以在全屏视图中看到您的照片。 要更正您的帖子,您必须通过调用 graph api "/{photoId}" (https://developers.facebook.com/docs/graph-api/reference/photo) 获取上传照片的详细信息,您将获得类似于以下内容的 JSON:

    {
    "created_time" = "";
    from =     {
        id = 100002300000000;
        name = "User User";
    };
    height = 500;
    id = 62902XXXXX;
    images =     (
                {
            height = 500;
            source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/XXXX.jpg";
            width = 500;
        },
                {
            height = 480;
            source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/p480x480/XXXX.jpg";
            width = 480;
        },
                {
            height = 320;
            source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/p320x320/XXXX.jpg";
            width = 320;
        },
                {
            height = 130;
            source = "https://fbcdn-photos-h-a.akamaihd.net/hphotos-ak-frc3/t1.0-0/XXXX.jpg";
            width = 130;
        },
                {
            height = 225;
            source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/p75x225/XXXX.jpg";
            width = 225;
        }
    );
    link = "https://www.facebook.com/photo.php?fbid=629020720517945&set=a.628961963857154.1073741825.100002300681060&type=1";
    picture = "https://fbcdn-photos-h-a.akamaihd.net/hphotos-ak-frc3/t1.0-0/1029_XXX.jpg";
    source = "https://scontent-b.xx.fbcdn.net/hphotos-frc3/t1.0-9/1029_XXX.jpg";
    width = 500;
    }
    

    您应该从响应中获取“图像”数组,然后获取缩略图“源”链接之一。 您可以使用“/me/feed”API (https://developers.facebook.com/docs/graph-api/reference/user/feed/) 上的“图片”键将此链接添加到帖子正文。

    注意:您必须调用“user_photos”权限才能获取照片信息。

    【讨论】:

      猜你喜欢
      • 2013-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-19
      • 2012-08-18
      相关资源
      最近更新 更多