【发布时间】:2020-11-24 22:33:27
【问题描述】:
我希望能够将链接与消息一起发送到 Facebook Messenger。在他们的文档上,他们说我需要为变量 quote 赋值,但没有成功,链接存在但引用不存在......
这是他们的文档:
/**
Some quote text of the link.
If specified, the quote text will render with custom styling on top of the link.
@return The quote text of a link
*/
@property (nonatomic, copy, nullable) NSString *quote;
我在 Swift 上使用他们的库:pod 'FBSDKShareKit', '6.5.2',所以我将它导入到我的桥接头中。
这是我使用它的代码块:
private func openFacebookMessenger(message: String, urlString: String) {
guard let url = URL(string: urlString) else { return }
let shareLinkContent = ShareLinkContent()
shareLinkContent.contentURL = url
shareLinkContent.quote = message
let dialog = MessageDialog()
dialog.shareContent = shareLinkContent
dialog.shouldFailOnDataError = true
if dialog.canShow {
dialog.show()
}
}
结果:
【问题讨论】:
-
引号是否可能被页面/url中的元数据元素替换?
-
您是否尝试设置
title或description而不是quote? -
@OleksiiNezhyborets 是的 :(
-
最新版本(截至今天为 9.0.0)不允许设置
title或description。
标签: ios swift facebook fbsdksharekit