0

I used the UIActivityViewController to sharing both Image and Text. In other apps like twitter, notes, email have all worked. In facebook it does not have text and have only image to share. Please help me how to share both Image and Text to work with Facebook and UIActivityViewController.

Here is my code :

    // 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)
Kawazoe Kazuke
  • 175
  • 6
  • 20

0 Answers0