[英]Can't add title and description in facebook Share
I am trying to implement the Facebook Share in my quiz app. 我正在尝试在测验应用程序中实现Facebook Share。 The content is app store link and quiz score.Which is working fine in simulator but in device shows in different and not showing my description.
内容是应用程序商店链接和测验分数。在模拟器中可以正常工作,但在设备中显示的内容有所不同,但未显示我的描述。 Here is my Code
这是我的代码
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
}
}
also attaching screen Shot of simulator and device. 还附有模拟器和设备的屏幕截图。
Why don't you use UIActivityController
for such functionality? 为什么不使用
UIActivityController
实现这种功能?
Example : 范例 :
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)
Edit: 编辑:
Check this out: https://stackoverflow.com/a/30020929/5716829 看看这个: https : //stackoverflow.com/a/30020929/5716829
now you cannot share image, text and url simultaneously in facebook. 现在,您无法在Facebook中同时共享图像,文本和url。 also Facebook does not allow pre filled text now
此外,Facebook现在也不允许预填文本
According to Facebook's 2.3 policy rules, you can't share pre-filled content because of policy violation. 根据Facebook的2.3政策规则,由于违反政策,您不能共享预填充的内容。 Facebook does not allow you to share the pre-filled user message parameters with any content the user didn't entered himself.
Facebook不允许您与用户未输入自己的任何内容共享预填充的用户消息参数。
If you want to share content on Facebook then user has to write/enter himself in Facebook prompt message dialog. 如果要在Facebook上共享内容,则用户必须在Facebook提示消息对话框中进行写/输入。
For more info, please visit: https://developers.facebook.com/docs/apps/review/prefill 有关更多信息,请访问: https : //developers.facebook.com/docs/apps/review/prefill
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.