3
我正在尝试使用Facebook SDK使用FB.Feed()
代替FB.API()
,使用户可以写一个消息,他们的帖子上传截图到Facebook。我能得到这个团结编辑工作,但是当我尝试在我的Android,我得到:使用Facebook SDK来上传截图在Unity
“这个对话框已经通过了错误的参数
API错误代码:100
API错误说明:无效的参数
错误消息:图片网址的格式不正确”
这里是我写的代码:
var width = Screen.width;
var height = Screen.height;
var 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();
File.WriteAllBytes(Application.persistentDataPath + "/Screenshot.png", screenshot);
//Application.CaptureScreenshot(Application.persistentDataPath + "/Screenshot.png");
Debug.Log(Application.persistentDataPath + "/Screenshot.png");
Debug.Log("Does File Exist? " + File.Exists(Application.persistentDataPath + "/Screenshot.png"));
Debug.Log("File://" + Application.persistentDataPath + "/Screenshot.png");
FB.Feed(
picture: "File://" + Application.persistentDataPath + "/Screenshot.png"
);