Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS share image AND text to WhatsApp

I have googled, and get some solutions, it seems the only possible way is thru UIDocumentInteractionController. I have found the result that able to share text ONLY, also found result that share image ONLY.

But what I want is share BOTH.

I know this question may be duplicated, I just wanted to make it clear, here is the screenshot...

WhatsApp share image + text

(This is shared from Android)

like image 955
Js Lim Avatar asked Apr 20 '15 07:04

Js Lim


People also ask

How can I write in WhatsApp in iOS?

For iOS Users Just open the image and choose the WhatsApp contact to whom you need to send the file to. Now, choose Document instead of Photo and select the image file you want to share for Files. That's it. The photo will be sent as an uncompressed file.


1 Answers

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

like image 72
Gauraw Avatar answered Sep 28 '22 11:09

Gauraw