我正在尝试使用 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];
答案 0 :(得分:1)
在供稿对话框中找出缺少信息的问题
事实证明,要正确显示信息,必须在 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];