0

Using Prime31 i can successfully upload an image to my own wall calling

public void postPhoto(byte[] photoBytes){
    Facebook.instance.postImage( photoBytes, "my message", completionHandlerUploadPhoto );
}

But now i want to post the same picture to an album of a Facebook-Page. I tried calling this function i've written:

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

The Callback function says that there is no error but the Facebook Page i am posting to says there is an error by having no uploaded picture.

I am logging in with the following rights:

FacebookAndroid.loginWithPublishPermissions( new string[] { "email", "user_birthday" } );

Maybe i have to add more rights?

Hope Someone can help me!

EDIT

I also tried out to take an album_id instead of the page_id but neither of it works. Theres is still no error... I printed out the dictionary of the callback:

{
    [id] = <some long number>,
    [post_id] = <some even longer number with a underline in center>,
}
BenMorel
  • 34,448
  • 50
  • 182
  • 322

1 Answers1

0

I don't know what i did exactly but know it is magically working... (mondays...)

That's the function:

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!");

    });
}

I hope i there is someone i could help :)