使用Prime31我可以成功将图像上传到我自己的墙上调用
public void postPhoto(byte[] photoBytes){
Facebook.instance.postImage( photoBytes, "my message", completionHandlerUploadPhoto );
}
但现在我想将相同的图片发布到Facebook-Page的专辑中。我试着调用我写的这个函数:
public void postToFatFishPage(byte[] photoBytes){
Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("access_token", FacebookAndroid.getAccessToken());
arguments.Add("message", "my message");
arguments.Add("image", photoBytes);
Facebook.instance.graphRequest("/"+facebookPageID+"/photos", HTTPVerb.POST, arguments, ( string error, object obj ) =>
{
Debug.Log ("In Callback postToFatFishPage");
// if we have an error we dont proceed any further
if( error != null ){
Debug.Log("Error posting Photo to FatFish FB-Page: " + error);
return;
}
Debug.Log("No error");
});
}
Callback功能表示没有错误,但我发帖的Facebook页面显示没有上传的图片有错误。
我正在使用以下权限登录:
FacebookAndroid.loginWithPublishPermissions( new string[] { "email", "user_birthday" } );
也许我必须添加更多权利?
希望有人可以帮助我!我也尝试过取一个album_id而不是page_id,但它们都不起作用。 Theres仍然没有错误......我打印出了回调字典:
{
[id] = <some long number>,
[post_id] = <some even longer number with a underline in center>,
}
答案 0 :(得分:0)
我不知道我做了什么,但知道它神奇地工作......(星期一......)
这就是功能:
public void postToFatFishPage(byte[] photoBytes){
Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("access_token", FacebookAndroid.getAccessToken());
arguments.Add("message, myMessage);
arguments.Add("image", photoBytes);
Facebook.instance.graphRequest("/"+pageID+"/photos/", HTTPVerb.POST, arguments, ( string error, object obj ) =>
{
// if we have an error we dont proceed any further
if( error != null ){
Debug.Log("Error posting Photo to FatFish FB-Page: " + error);
return;
}
Debug.Log("SUCCESS!");
});
}
我希望我有人可以提供帮助:)。