我正在开发一个统一游戏,您可以在其中拍照并将这张照片从统一上传到 Facebook,以及一些标签和东西(很像friendsmash)。问题是我没有可以放截图的网络服务器,而且 Fb.Feeb(picture:) 属性只接受 url。
我已经读到您可以使用 HTTP POST 将图片发布到用户图像,然后使用图片中的链接:,但我对 HTTP POST 一无所知,我不知道该怎么做。
我还读到您可以使用 FB.API() 以某种方式做到这一点,但我无法弄清楚。
任何示例代码将不胜感激。
我当前的代码:
private string _path = "file://" + System.IO.Path.Combine(Application.persistentDataPath, "Images/image.png");
void Start ()
{
if (!FB.IsLoggedIn)
FB.Login("email, publish_actions, publish_stream, user_photos", LoginCallback);
StartCamera();
}
private void OnBragClicked()
{
FbDebug.Log("OnBragClicked");
//Post(); <-- dont know how
FB.Feed(
linkCaption: "#hashtag",
picture: "???",
linkName: "Im hashtaging!",
link: "https://apps.facebook.com/" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest")
);
}
void TakeSnapshot()
{
_snap = new Texture2D(_webCamTexture.width, _webCamTexture.height);
_snap.SetPixels(_webCamTexture.GetPixels());
_snap.Apply();
//System.IO.File.WriteAllBytes(_path, _snap.EncodeToPNG());
}