有没有人成功地通过Facebook的SDK上传的图像(不是URL)? [英] Has anyone succeeded in uploading an image (not a url) via Facebook's SDK?

查看:100
本文介绍了有没有人成功地通过Facebook的SDK上传的图像(不是URL)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待所有的地方为一个端到端的使用Android的Facebook SDK来上传图片到用户的墙*工作的例子。我已经成功地与一个链接到一个网页访问图像这样做,但他们说这可能只是提出一个字节数组,但是,当我尝试这一点,我刚刚得到在墙上的空职位(它甚至省略标题和说明)。

I am looking all over the place for an end to end *working example of using the Android Facebook SDK to upload an image to a user's wall. I've succeeded in doing this with a link to a web accessible image, but they say it's possible to just submit a byte array, however, when I try this, I just get an empty post on the wall (it even omits the title and description).

我已经使用照片和图像作为哈希键的字节数组...我的字节数组是一个完全有效的位图试过...所以...我难倒。这只是另一种越野车的Facebook的API,它不工作?我很想知道是否有人已经成功地使用它,也许看看c您来看看我的怎么是不同的$ C $。

I've tried using photo and image as the hash keys for the byte array... my byte array is a perfectly valid Bitmap... So... I'm stumped. Is this just another buggy Facebook API that doesn't work? I'd love to know if anyone has used it successfully and maybe take a look at the code you used to see how mine is different.

下面是我的......

Here's mine...

ByteArrayOutputStream stream = new ByteArrayOutputStream();
comboBitmap.compress(Bitmap.CompressFormat.JPEG, 60, stream);   
Log.d(Constants.TAG, "filled stream");


byte[] bitmapdata = stream.toByteArray();   

Bundle b = new Bundle();
//b.putString("picture","http://myinkpic.com/images/inkIcon.png");


b.putString("caption", "Stash Title");
b.putString("description", "Stash Caption");
b.putByteArray("photo", bitmapdata);
myApp.facebook.request("me/feed", b, "POST");

和这里有一个链接到开发页面,他们提的byte [] [Facebook的API] 1

And here's a link to the dev page where they mention the byte[] [Facebook api]1

请注意他们是如何说的: 确保为照片参数捆绑的值是一个字节数组。

Notice how they say this: "Make sure the Bundle value for the photo parameter is a byte array."

这就是给我用光为重点的想法。实际上它可能是完全错误的,但我似乎无法找到的文档现在他们定义键。

That's what gave me the idea to use "photo" as the key. It may in fact totally wrong, but I can't seem to find the docs now for where they define the keys.

推荐答案

好了,经过多次痛苦的搜索和测试它会出现,只要请求方法是我/饲料,发布一个byte [],根本就不是可能。 *什么不工作是张贴到我/照片。这具有非常相似的效果,在该图像确实到达了用户的库和在其壁终止了,但如果在发布多个图像他们都去并排,而不是在一个列表中。

Well, after much painful searching and testing it would appear that so long as the request method is "me/feed", posting a byte[] is simply not possible. What *does work is posting to me/photos. This has a very similar effect, in that the image does get to the user's gallery and ends up on their wall, but if you post multiple images they all go side by side, rather than in a list.

厚福Facebook将某个时候发布一个更新在短期内解决这个问题。

Hopefull Facebook will release an update sometime in the near term fixing this bug.

这篇关于有没有人成功地通过Facebook的SDK上传的图像(不是URL)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆