3

我引用了 Facebook SDK3.0 中的示例代码,使用 WebDialog 在我的墙上发布故事。

示例代码演示了用于构造 WebDialog.FeedDialogBu​​ilder 的 Bundle 对象

Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
params.putString("link", "https://developers.facebook.com/android");
params.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");

所以我改变了一些词来测试我的项目:

Bundle params = new Bundle();
params.putString("name", "Push test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "");

但是 WebDialog.FeedDialogBu​​ilder 上的“名称”、“标题”、“描述”的结果消失了

然后我发现了params.putString("picture", "");

如果 URL 无效或字符串为空,则 WebDialog.FeedDialogBu​​ilder 将不起作用。

带空字符串:

Bundle params = new Bundle();
params.putString("name", "Test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "");

在此处输入图像描述

使用无效的网址:

Bundle params = new Bundle();
params.putString("name", "Test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "null");

在此处输入图像描述

任何有效的网址:

Bundle params = new Bundle();
params.putString("name", "test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "http://www.technobuffalo.com/wp-content/uploads/2012/12/Google-Apps.jpeg");

在此处输入图像描述

仅使用三个参数:

Bundle params = new Bundle();
params.putString("name", "test");
params.putString("caption", "hello");
params.putString("description", "hello");

在此处输入图像描述

那么,我应该如何将正确的值传递给params.putString("picture", "");

可以让它在没有图片的情况下工作吗?

4

2 回答 2

2

实际的问题是您对“链接”没有任何价值。

“名称”、“标题”、“描述”和“图片”都适用于链接字段。我不知道为什么当你有“图片”而不是“链接”的值时会显示任何东西,但我很确定问题是因为你没有“链接”。

于 2013-02-27T05:51:33.030 回答
0

试试这个

Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
params.putString("link", "https://developers.facebook.com/android"); // required filed
params.putString("picture", "");
于 2013-02-27T05:03:52.943 回答