UIActivityViewController不在Facebook上共享文本和图像

时间:2018-04-27 04:47:41

标签: ios facebook share socialshare swift4.1

我使用UIActivityViewController来共享图像和文本。在其他应用程序,如Twitter,笔记,电子邮件都工作。在Facebook,它没有文字,只有图像分享。请帮助我如何共享图像和文本以使用Facebook和UIActivityViewController。

这是我的代码:

    // Screenshot the Result Page

    UIGraphicsBeginImageContext(view.frame.size)

    view.layer.render(in: UIGraphicsGetCurrentContext()!)

    let image = UIGraphicsGetImageFromCurrentImageContext()

    UIGraphicsEndImageContext()


    // Prepare to share.

    let text = "Let`s start to play Kanji Quiz. Improve your Kanji skills."

    let shareAll = [text , image!] as [Any]

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

    activityViewController.excludedActivityTypes = [ UIActivityType.message, UIActivityType(rawValue: "com.apple.reminders.RemindersEditorExtension"), UIActivityType(rawValue: "com.apple.mobilenotes.SharingExtension"), UIActivityType.airDrop, UIActivityType.addToReadingList, UIActivityType.assignToContact, UIActivityType.print, UIActivityType.markupAsPDF ]

    activityViewController.popoverPresentationController?.sourceView = self.view
    self.present(activityViewController, animated: true, completion: nil)

0 个答案:

没有答案