我嘗試爲共享鏈接內容添加說明和標題。我使用的吊艙「Facebook分享」(因爲當我使用FBSDKShareKit,說明和標題不建議使用)無法使用Facebook共享鏈接內容爲網址添加說明和標題
https://i.stack.imgur.com/9p9lp.jpg
這是我的代碼「Facebook分享」:
do{
var myContent: LinkShareContent = LinkShareContent(url: NSURL(string:contentUrl!) as! URL)
myContent.description = "Some description"
myContent.title = "Hello"
let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .shareSheet
shareDialog.presentingViewController = self
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
// Handle share results
}
try shareDialog.show()
} catch {
print("Error: \(error)")
}
但我可以看到說明和標題僅當我使用時: shareDialog.mode = .native 在所有其他情況下(.shareSheet,.Web,.Browser,.FeedWeb,.FeedBrowser)它們不會被添加。我不想使用.native模式,因爲不是每個人都有原生Facebook應用程序。 我的情況是否有解決方案?
**** UPDATE:****
建立適當的meta標籤的網站(這是我分享的網址)本身標題,描述和圖像值以及其他變量上。
我試過使用社會圖書館。它也不幫助我。共享是工作,但不添加初始文本。我正在使用設備。 Xcode 8.2.1,Swift 3.0。可能我必須使用.native模式。 – DmitriyYefremov
我已經更新了我的答案。我用你的方法試了一下。你可以再次嘗試使用我的答案中最重要的代碼嗎? – kkakkurt
我試過了。方法myContent.contentTitle,myContent.contentDescription從Graph API 2.9中棄用。所以我認爲這些方法不被使用。而Facebook從url的元描述中獲得這些字段。 – DmitriyYefremov