我正在尝试发布到Facebook,其工作正常,但我的内容变量中没有任何字符串被添加到共享对话框中。
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "<INSERT STRING HERE>")
content.contentTitle = "My Title Here"
content.contentDescription = "My description here!"
content.imageURL = NSURL(string: "<INSERT STRING HERE>")
let shareDialog = FBSDKShareDialog()
shareDialog.fromViewController = self
shareDialog.shareContent = content
shareDialog.delegate = self
if !shareDialog.canShow() {
print("cannot show native share dialog")
}
shareDialog.show()
答案 0 :(得分:0)
Facebook的政策不允许您预先填充状态消息,并要求所有内容都是用户生成的。这是我所做的,我设法在Facebook弹出窗口中获取URL:
let activityItems = ["My app text", "", "http://google.com"]
let vc = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
self.presentViewController(vc, animated: true, completion: nil)
如果我打开Twitter,我会得到&#34;我的应用文字&#34;和URL,对于Facebook我只获得URL。