问题
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.
回答1:
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
回答2:
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
回答3:
I am not sure but you should try at this link.
Also, I got WhatsApp API at github check it may be helpful for you.
回答4:
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];
}
回答5:
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.
来源:https://stackoverflow.com/questions/16786145/whatsapp-link-on-products