[英]No info in FB feed dialog when picture is missing
我正在嘗試使用FBConnect sdk發布到Facebook。
當我提供圖片的鏈接時,一切正常。
但是,當圖片丟失時,將不會顯示其他任何信息。
我是在做錯什么,還是FBConnect中的錯誤。
代碼是:
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setValue:name forKey:@"name"];
[params setValue:address forKey:@"caption"];
[params setValue:descrption forKey:@"description"];
[params setValue:website forKey:@"link"];
if(thumbnail.serverPath)
[params setValue:thumbnail.serverPath forKey:@"picture"];
[facebook dialog:@"feed" andParams:params andDelegate:self];
解決了Feed對話框中缺少信息的問題。
事實證明,要正確顯示信息,必須在params字典中設置鏈接或圖片 。
不確定,為什么會這樣。 但是無論如何,解決問題的新代碼是:
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setValue:name forKey:@"name"];
[params setValue:address forKey:@"caption"];
[params setValue:descrption forKey:@"description"];
[params setValue:website forKey:@"link"];
if(thumbnail.serverPath)
[params setValue:thumbnail.serverPath forKey:@"picture"];
//IMPORTANT
//Before posting check that there is a valid link for the picture.
//If not, then add
//to ensure that rest of the info is displayed correctly in the feed.
if(![params valueForKey:@"picture"]) {
[params setValue:@"http://www.abc.com/images/xyz.png" forKey:@"picture"];
}
[facebook dialog:@"feed" andParams:params andDelegate:self];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.