JBWhatsAppActivity is a UIActivity subclass that provides an “Share in WhatsApp" action to a UIActivityViewController.
- Drag JBWhatsAppActivity.h .m and whatsapp.png files into your project.
- If a message and an ABID is provided, JBWhatsAppActivity sends a direct message to a contact.
- If just a message is defined, JBWhatsAppActivity opens WhatsApp contact picker to select a receiver.
- If no message and ABID is provided, then JBWhatsAppActivity just open WhatsApp.
(see example Xcode project in /DemoProject)
WhatsAppMessage *whatsappMsg = [[WhatsAppMessage alloc] initWithMessage:_messageTextField.text forABID:_abidTextField.text];
activityItems = @[_messageTextField.text, whatsappMsg];
NSArray *applicationActivities = @[[[JBWhatsAppActivity alloc] init]];
NSArray *activityItems = @[_messageTextField.text, whatsappMsg];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
[self presentViewController:activityViewController animated:YES completion:^{}];
Javier Berlana, Sweetbits