出版流没有图像 - Facebook

时间:2009-12-07 21:43:04

标签: c# facebook

我正在使用c#中的Facebook开发人员工具包3.0构建一个小型的facebook应用程序。我有一段代码,曾经在一周前工作过。出于某种原因,当我尝试发布我的Feed时,它会显示没有图像且没有Flash电影。这是我的代码:

string userName = FacebookAPI.Users.GetInfo().name;
string message = "";

attachment attach = new attachment();

attach.href = string.Format(@"http://apps.facebook.com/{0}/?uId={1}&uName={2}", Consts.APP_NAME, ViewerUserId, userName);

attachment_media_flash flash = new attachment_media_flash();
flash.type = attachment_media_type.flash;
flash.expanded_width = 320;
flash.expanded_height = 260;
flash.height = 100;
flash.width = 130;

message = "";
attach.name = ""
attach.caption = "this works";
attach.description = ""
flash.imgsrc = string.Format(@"{0}/flash/Pinguin.JPG", Consts.DOMAIN_NAME);
flash.swfsrc = string.Format(@"{0}/flash/pinguin.swf", Consts.DOMAIN_NAME);

List<attachment_media> attach_media_list = new List<attachment_media>();
attach_media_list.Add(flash);

attach.media = attach_media_list;


/* action links */
List<action_link> actionlink = new List<action_link>();

action_link al1 = new action_link();
al1.href = string.Format(@"http://apps.facebook.com/{0}", Consts.APP_NAME);
al1.text = "myApp";

actionlink.Add(al1);
FacebookAPI.Stream.Publish(message, attach, actionlink, null , Convert.ToInt64   (ViewerUserId));

1 个答案:

答案 0 :(得分:1)

确保:

1:您传递的网址不是FB应用的网址,例如http://apps.fb.co/whatever/image.jpg; 它应该是您的域名网址,例如http://www.example.com/images/myimage.jpg

2:您需要传递图片的完整网址,包括协议(http:// / https://),如下所示:
http://www.example.com/images/myimage.jpg

以下是错误的:

www.example.com/images/myimage.jpg