FBSDKShareLinkContent没有设置contentDescription和contentTitle [英] FBSDKShareLinkContent is not setting the contentDescription and contentTitle

查看:898
本文介绍了FBSDKShareLinkContent没有设置contentDescription和contentTitle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 FBSDKShareLinkContent 在Facebook上分享一个链接。

I am trying to share a link on the Facebook using FBSDKShareLinkContent.

我已经设置了URL,描述和标题。 SDK通过从 contentURL 中的信息自动填充标题和说明。

I have set the URL, description and title. SDK is automatically populates the title and description by information scraped from the contentURL.

但是我想设置我在代码中给出的自定义标题和描述。有没有办法避免这种行为?

But I want to set custom title and description that I have given in code. Is there anyway to avoid this behaviour?

  FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
[content setContentTitle:@"Testing title"];
[content setContentDescription:@"Testing description."];
content.contentURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.google.co.in/"]];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:nil];


推荐答案

我遇到同样的问题,发现一个解决方法 - FBSDKShareDialog实例到FBSDKShareDialogModeFeedWeb的直接设置模式。

I've faced a same problem and found out one workaround - direct setting mode of FBSDKShareDialog instance to FBSDKShareDialogModeFeedWeb.

FBSDKShareDialog* dialog = [[FBSDKShareDialog alloc] init];
dialog.mode = FBSDKShareDialogModeFeedWeb;
dialog.shareContent = content;
dialog.fromViewController = self;
[dialog show];

它在应用程序的UIWebView中显示Feed对话框,其中包含正确的标题和描述。

It displays the feed dialog in a UIWebView within the app with preview of your post with right title and description.

这篇关于FBSDKShareLinkContent没有设置contentDescription和contentTitle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆