缺少图片时,FB feed对话框中没有信息

时间:2012-08-01 07:27:11

标签: iphone objective-c ios facebook ipad

我正在尝试使用 FBConnect sdk发布到Facebook 当我提供图片链接时,一切正常 enter image description here

但是当图片丢失时,其他信息都没有显示出来 enter image description here
我做错了什么,或者这是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];

1 个答案:

答案 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];