iOS share image AND text to WhatsApp iOS share image AND text to WhatsApp ios ios

iOS share image AND text to WhatsApp


You can use UIActivityViewController to share image , text or URL .Here is a small example :

NSString *textToShare = @"Enter your text to be shared";UIImage * image = [UIImage imageNamed:@"imagename"];NSArray *objectsToShare = @[textToShare, image];UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];[self presentViewController:activityVC animated:YES completion:nil];

Run the above code and select whats app to share if you want you can share by other mediums also . This is apple's default share method


something not usually mentioned the user doesn't actually needs to share a text message and an image.

If your text contains URL then the whatsapp application will try to retrieve info about the URL and show a preview

In order for this to work you need to make the URL conform to open graph protocol. that basically means that the URL needs to have meta tags in its DOM which contain the relevant preview data


Good one,

As I know it is not possible in ios.But I am having an alternate solution for it by which you can share text and image both.But it's a tricky or I think stupid solution.

  1. Create a View where you can put your image.Write text on that view whatever you want to write.
  2. Take Screen shot of that view with help of code.You will get image (image of view where text and image added).
  3. Just share that image via document interaction controller.

This is just a possible solution if you want text and image both.But if you want to share link with text than . . . . . . .