Facebook图形API分享链接

3

我想使用Facebook Graph API分享链接,我正在执行以下操作。

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                    @"Description goes here.",@"description",
                                   @"www.google.com/image.jpg",@"picture",
                                   @"www.google.com/invites/username", @"link",
                                   @"Google",@"name",
                                   @"www.google.com",@"caption",
                                   nil];


    Facebook *fb = [Model shared].facebook;

    [fb requestWithGraphPath:@"me/links" andParams:params andHttpMethod:@"POST" andDelegate:self];

我希望这个FB帖子像这样:enter image description here

但是我了解到,Facebook Graph API自动从分享页面中获取图像和描述。

有没有办法自定义要分享的内容呢?

1个回答

4
如果您发布链接,Facebook会从您指定为链接URL所在页面获取OpenGraph标签(如picturedescription)。

使用Graph API通过发布post对象而不是链接,可以指定自定义信息。

实际上,要实现此功能,您只需将me/links更改为me/feed

[fb requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

但是在这种情况下,标题(即我的情况下的www.google.com)将不会成为一个链接。 - Soni
我认为没有办法以我想要的方式获取帖子的类型。 - Soni
@Juicy,名称、描述、标题等的字符限制是多少? - user3306145

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接