2009-12-07 48 views
0

我正在使用C#中的Facebook開發人員工具包3.0構建一個小型Facebook應用程序。我有一段曾經在一週前工作過的代碼。由於某種原因,當我嘗試發佈我的Feed時,它會顯示沒有圖像且沒有Flash電影。這裏是我的代碼:發佈流顯示沒有圖像 - Facebook

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

確保:

1:您通過URL不是一個在FB應用程式,例如http://apps.fb.co/whatever/image.jpg的; 它應該是您的域名網址,例如http://www.example.com/images/myimage.jpg

2:您需要通過圖像包括協議(http:///https://)的完整URL,例如:
http://www.example.com/images/myimage.jpg

以下是錯誤的:

www.example.com/images/myimage.jpg