繁体   English   中英

无法在Facebook分享中添加标题和描述

[英]Can't add title and description in facebook Share

我正在尝试在测验应用程序中实现Facebook Share。 内容是应用程序商店链接和测验分数。在模拟器中可以正常工作,但在设备中显示的内容有所不同,但未显示我的描述。 这是我的代码

    func ShareFB() {
    let fbVC = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
    fbVC?.setInitialText("Hey! I scored \(String(describing: UserDefaults.standard.string(forKey: "TOTAL_SCORE")!)) in Test. This is really interesting! You can also try.")
    fbVC?.add(URL(string: "https://itunes.apple.com/us/app/test-app/i?ls=1&mt=8"))
    fbVC?.add(UIImage(named: "AppIcon"))
    present(fbVC!, animated: true) { _ in

    }
}

还附有模拟器和设备的屏幕截图。 模拟器截图

设备的屏幕截图

为什么不使用UIActivityController实现这种功能?

范例

    let shareItems = [
        "Hey! I scored \(String(describing: UserDefaults.standard.string(forKey: "TOTAL_SCORE")!)) in Test. This is really interesting! You can also try.",
        URL(string: "https://itunes.apple.com/us/app/test-app/i?ls=1&mt=8"),
        UIImage(named: "AppIcon")] //Add the items you want to share in this array

    let activityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil)

    self.present(activityViewController, animated: true, completion: nil)

编辑:

看看这个: https : //stackoverflow.com/a/30020929/5716829

现在,您无法在Facebook中同时共享图像,文本和url。 此外,Facebook现在也不允许预填文本

根据Facebook的2.3政策规则,由于违反政策,您不能共享预填充的内容。 Facebook不允许您与用户未输入自己的任何内容共享预填充的用户消息参数。

如果要在Facebook上共享内容,则用户必须在Facebook提示消息对话框中进行写/输入。

有关更多信息,请访问: https : //developers.facebook.com/docs/apps/review/prefill

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM