【问题标题】:Can't add title and description in facebook Share无法在 facebook Share 中添加标题和描述
【发布时间】:2018-01-15 14:02:32
【问题描述】:

我正在尝试在我的测验应用中实现 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

    }
}

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

【问题讨论】:

  • 这是来自 facebook 的错误。如果您在设备中安装应用程序,则不会显示任何类型的文本。
  • 先从设备中删除应用然后检查
  • 好的,但这不是正确的方法。
  • 是的,我知道这是 fb 错误

标签: ios iphone swift facebook share


【解决方案1】:

现在您无法在 facebook 中同时分享图片、文字和网址。 Facebook现在也不允许预填充文本

【讨论】:

  • 好的,但我想知道另外一件事,在游戏应用程序中他们如何分享最高分?谢谢你的回答
  • 他们要么使用分数/成就 API,要么为每个结果创建单独的 URL,提供正确的 OG 元数据以在标题/描述/缩略图中显示结果...
【解决方案2】:

为什么不使用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

【讨论】:

  • 是的,我试过但得到了相同的结果。没有在设备中显示我的描述。
【解决方案3】:

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

如果您想在 Facebook 上分享内容,则用户必须在 Facebook 提示消息对话框中写/输入自己。

欲了解更多信息,请访问:https://developers.facebook.com/docs/apps/review/prefill

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-28
    • 2014-10-31
    • 1970-01-01
    • 1970-01-01
    • 2021-12-30
    • 1970-01-01
    相关资源
    最近更新 更多