簡體   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