0

Suppose I have few forms that needs to be filled by the user including contact number. After filling of all the forms, I want that contact number should receive a message including some greetings or some text or image clicked to use in the form. The message should be delivered as a simple SMS and also on WhatsApp. All this needs to be done without opening WhatsApp. Is it possible? If yes then how? Thanks in advance.

Ted
  • 22,696
  • 11
  • 95
  • 109
simardeep singh
  • 220
  • 2
  • 11

2 Answers2

1

I don't think this can be possible.

Yes you can set body of message using 'MFMessageComposeViewController' that involves user-interaction that means without user tapping simple message cant be sent otherwise spams could easily be written.

As far as send message via whatsApp, without opening whatsApp I guess you can only open application

NSURL *whatsAppURL = [NSURL URLWithString:@"Whatsapp://location?id=1"];

 if ([[UIApplication sharedApplication] canOpenURL:whatsAppURL]) {
        [[UIApplication sharedApplication] openURL:whatsAppURL]]];
 }

Every application has it's Own 'Sandbox' a File System that can not be access outside boundary of that app.

And on iOS 9 you have to add "Whatsapp" under a proper key in your info.plist iOS 9 not opening Instagram app with URL SCHEME

Community
  • 1
  • 1
Muhammad Awais
  • 340
  • 3
  • 15
0

I think you should use UIActivityViewController but you need to customise it for WhatsApp and there is open source here he prepared everything :)

Hady Nourallah
  • 442
  • 4
  • 12