12

For the iPhone Apps, is it possible to have a Whatsapp link on products? Once link it would send a message to my mobile number through whatsapp. Please advice.

SampathKumar
  • 2,525
  • 8
  • 47
  • 82

4 Answers4

2

You do it either of the method as tafh suggested which is custom method or as an iOS app developer I would suggest you to go with document interaction controller, initialize a UIDocumentInteractionController. These both with help you manage interactions. Check the link below for more information.

  (UIDocumentInteractionController *) setupControllerWithURL: (NSURL) fileURL
        usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {

    UIDocumentInteractionController *interactionController =
        [UIDocumentInteractionController interactionControllerWithURL: fileURL];
    interactionController.delegate = interactionDelegate;

    return interactionController;
}

Here

laalto
  • 150,114
  • 66
  • 286
  • 303
1
notification = @"Your Daily Inspiration by the ";
notification = [notification stringByAppendingString:@"\n"];    
notification = [notification stringByAppendingString:textview.text];
NSString *whats=notification;
NSString *baseURL = [NSString stringWithFormat:@"whatsapp://send?text=%@",whats];
NSURL *url = [NSURL URLWithString:[baseURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

if ([[UIApplication sharedApplication] canOpenURL: url]) {
    [[UIApplication sharedApplication] openURL: url];
}
else
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry"
                                                        message:@"You can't send a thought on Whatsapp"
                                                       delegate:self
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
    [alertView show];

}

used this code i m sending following string on whatsapp

Vaibhav Saran
  • 12,848
  • 3
  • 65
  • 75
Jatiendar Kumar
  • 257
  • 2
  • 12
0

I'm not sure exactly what you mean but perhaps this is what you're looking for: http://www.whatsapp.com/faq/en/iphone/23559013

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
[[UIApplication sharedApplication] openURL: whatsappURL];
}
tafh
  • 181
  • 4
0

you should look at below link

http://handleopenurl.com/scheme/833

it will give you all open url scheme option for all apps and you can register your app as well.

Paras Gandhi
  • 823
  • 1
  • 13
  • 28