【发布时间】:2014-05-09 11:07:24
【问题描述】:
我正在尝试使用 Facebook SDK 使用 FB.Feed() 而不是 FB.API() 将屏幕截图上传到 Facebook,以便用户可以在他们的帖子中写入消息。我能够让它在 Unity 编辑器上工作,但是当我在我的 Android 上尝试它时,我得到:
"这个对话框传递了一个错误的参数。
API 错误代码:100
API 错误说明:参数无效
错误信息:图片 URL 格式不正确”
这是我写的代码:
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"
);
【问题讨论】:
标签: android facebook url unity3d