5

Could anyone suggest me how to share image with text to whatsaap or any alternative for the same.I have tried it using UIActivityViewController but its possible to share image+text simultaneously on mail bt not on whatsaap . Help will be appreciated. Thank you :)

code is as follows:

let textToShare = "Hello world" 
let myWebsite = NSURL(string:"https://www.apple.com/")
let img = UIImage(named:"BookImg")

let shareall = [img!,textToShare,myWebsite!] as [Any]

let vc = UIActivityViewController(activityItems: shareall, applicationActivities: nil)

vc.popoverPresentationController?.sourceView = self.view

self.present(vc, animated: true, completion: nil)
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
dev
  • 51
  • 1
  • 4
  • as a alternative to above, can anyone please tell me how to add caption to image so that i can share image+text on whatsaap? – dev Feb 14 '18 at 08:51
  • this may be help you https://faq.whatsapp.com/en/iphone/23559013 – Rocky Feb 14 '18 at 09:29
  • 1
    This question has been asked many times on SO. You can share text OR an image to WhatsApp (and Facebook and Messenger), but not both together. – Ashley Mills Jul 17 '18 at 09:34
  • @dev Please ask about adding a caption to an image as a new question. – Ashley Mills Jul 17 '18 at 09:43

1 Answers1

0

Sorry, but you can't post Images and Text together on WhatsApp. However, you can post one at a time. As Whatsapp does not provide any API you can add captions and post images with text.

For your reference , WhatsApp:

http://www.whatsapp.com/faq/en/iphone/23559013

An easy alternative is handing the image part from your server side. Host it and share the link along with the caption. the image will be shown automatically through the URL you are sharing. It will appear like below,

SS: https://ibb.co/7tpqm8S