图片上传到Facebook,但未显示在页面上 [英] Image uploaded to Facebook but not shown on page

查看:246
本文介绍了图片上传到Facebook,但未显示在页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过来自ipad应用程序的图表API来将图像上传到Facebook页面上的特定专辑。一切都正常工作,Facebook的响应成功返回成功,但我看不到页面上的图像。我正在使用Appcelerator Titanium。以下是我的代码:

I am trying to upload an image to a specific album on Facebook page through Graph api call from ipad app. Everything is working correctly and the response from Facebook returns success with the id of post but I just can't see the image uploaded on the page. I am doing this using Appcelerator Titanium. Following is my code:

var fb = require('facebook');
fb.appid = 'MY APP ID';
fb.permissions = ['read_stream'];

function postImageToFb(){
    fb.reauthorize(['publish_actions','manage_pages'], 'me', function(e){
      if (e.success) {
        // If successful, proceed with a publish call
        var data = {
            source: Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory+'/image.png').read(),
            message: 'Hello pic'
        }
        fb.requestWithGraphPath('<album-id>/photos',data,'POST',function(e){
            alert('Post to fb: '+JSON.stringify(e));
            if(e.success){
                alert('Photo submitted successfully to fb.')
            }else{
                alert('Failed to upload photo to fb: ')
            }
        })
    } else {
        if (e.error) {
            alert(e.error);
        } else {
            alert("Unknown result");
        }
    }
  });
}

$.btn_submit.addEventListener('click',function(e){
  if(fb.loggedIn){
    postImageToFb();
  }else{
    fb.authorize();
    fb.addEventListener('login',function(e){
        if(e.success){
            postImageToFb();
        }else{
            alert('Failed to login fb: ',e);
        }
    })
  }
})

我已经使用相同的帐户创建Facebook应用程序,页面和Facebook从应用程序登录,所以不应该是问题。可能是什么问题?有人能帮我吗。谢谢。

I have used the same account for creating Facebook app, page and Facebook login from app so it shouldn't be the problem. What might be the problem? Can someone help me. Thanks.

推荐答案

我无法获取请求WithGraphPath()与页面一起工作,即使使用页面的访问令牌。它将始终发布到页面墙壁,但作为我的个人资料。

I could never get the requestWithGraphPath() to work with a page, even with the access token FOR the page. It would always post to the Pages wall, but as my personal profile.

看看我在这里做了什么(在配置文件解释是页面上的一个解释之下): https://stackoverflow.com/a/28144909/4121164

See how I ended up doing it here (underneath the profile explanation is an explanation on Pages): https://stackoverflow.com/a/28144909/4121164

这篇关于图片上传到Facebook,但未显示在页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆