图片丢失时,FB feed对话框中没有信息

时间:2021-10-27 19:07:37

I'm trying to post to Facebook using the FBConnect sdk.
When I supply the link for the picture, everything works fine.
图片丢失时,FB feed对话框中没有信息

But when the picture is missing, none of the other info's are shown.
图片丢失时,FB feed对话框中没有信息
Am I doing something wrong or this is a bug in FBConnect.
The code is:

我正试图使用​​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];

1 个解决方案

#1


1  

Figured the problem with the missing information in the feed dialog.
Turned out that, to display the info properly, either link or picture must be set in the params dictionary.
Not sure, why it is so. But anyway, the new code which solved the problem is:

在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];

#1


1  

Figured the problem with the missing information in the feed dialog.
Turned out that, to display the info properly, either link or picture must be set in the params dictionary.
Not sure, why it is so. But anyway, the new code which solved the problem is:

在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];