Image uploaded to Facebook but not shown on page

旧城冷巷雨未停 提交于 2019-12-25 01:18:37

问题


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);
        }
    })
  }
})

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.


回答1:


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.

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



来源:https://stackoverflow.com/questions/28022214/image-uploaded-to-facebook-but-not-shown-on-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!