I am trying to get my app (iOS, Android) to allow users to post a screenshot to facebook with a link and a description. I am able to use FB.API() to upload screenshots from my app to a user's album that Facebook autogenerated for my app, via:
int width = Screen.width;
int height = Screen.height;
Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false);
// Read screen contents into the texture
tex.ReadPixels(new Rect(0, 0, width, height), 0, 0);
tex.Apply();
byte[] screenshot = tex.EncodeToPNG();
var wwwForm = new WWWForm();
string picName = "Idioman_" + Time.time + ".png";
wwwForm.AddBinaryData("image", screenshot, picName);
Debug.Log("trying to post screenshot");
FB.API("me/photos", Facebook.HttpMethod.POST, PostPicCallback, wwwForm);
And I am able to use FB.Feed() to post an image from the internet with a link and a description to a user's feed. Is there a way to post the screenshot to a user's feed with a link and a description?
var snap = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
snap.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
snap.Apply();
var screenshot = snap.EncodeToPNG();
int i = UnityEngine.Random.Range (0, 2);
var wwwForm = new WWWForm();
wwwForm.AddBinaryData("image", screenshot, "picture.png");
wwwForm.AddField ("name", "this will be the caption for the image");
FB.API("me/photos", HttpMethod.POST, CallbackUploadImage, wwwForm);
you can refer here for more details of the available fields
https://developers.facebook.com/docs/graph-api/reference/v2.2/photo