我正在使用C_中的Facebook开发者工具包3.0构建一个小型Facebook应用程序。我有一周前用过的这段代码。出于某种原因,当我尝试发布我的提要时,它出现时没有图像,也没有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:你传递的网址不是FB应用程序的网址,比如 http://apps.fb.co/whatever/image.jpg ; 它应该是您的域URL,比如 http://www.example.com/images/myimage.jpg .
http://apps.fb.co/whatever/image.jpg
http://www.example.com/images/myimage.jpg
2:您需要传递包含协议的图像的完整URL( http:// / https:// ,像这样: http://www.example.com/images/myimage.jpg
http://
https://
以下错误:
www.example.com/images/myimage.jpg