0

I'm implementing sharing in an application and I must be able to share with many applications, including WhatsApp

@objc static func shareItem(viewController: UIViewController, position: CGRect, item: [Any], subject: String) {

    // item = [image, title, content, signature]
    let activityVC = UIActivityViewController(activityItems: item, applicationActivities: nil)
    activityVC.popoverPresentationController?.sourceView = viewController.view
    activityVC.popoverPresentationController?.sourceRect = position
    activityVC.setValue(subject, forKey: "subject")

    viewController.present(activityVC, animated: true, completion: nil)
}

I know that WhatsApp does not allow text and image sharing at the same time, so I would only like to share the image.

The problem is that the function I use to share with WhatsApp is also used to share with all other applications, so I can't just leave the image alone in my table

Is there a way to detect that the user will share with WhatsApp and then only send the image?

Thank you in advance

R3J3CT3D
  • 196
  • 1
  • 10
  • check this [link](https://faq.whatsapp.com/en/iphone/23559013), Use can `openUrl` method for checking – Pratik Prajapati Aug 03 '18 at 08:18
  • Check This : https://faq.whatsapp.com/en/iphone/23559013 – Sagar Shirbhate Aug 03 '18 at 08:56
  • I know it is possible to use this, the problem is that I have no way of knowing if the user will share with WhatsApp or Facebook or by email or by... – R3J3CT3D Aug 03 '18 at 09:04
  • You can create your own uiactivity. This way you have more control over what you want. check this https://stackoverflow.com/a/30472185/2299040 – Sahil Aug 03 '18 at 09:38

0 Answers0