对于 iPhone 应用程序,是否可以在产品上添加 Whatsapp 链接?一旦链接它会通过whatsapp向我的手机号码发送一条消息。请指教。
问问题
3392 次
4 回答
2
您可以使用 tafh 建议的自定义方法,或者作为 iOS 应用程序开发人员,我建议您使用文档交互控制器,初始化 UIDocumentInteractionController。这些都可以帮助您管理交互。检查下面的链接以获取更多信息。
(UIDocumentInteractionController *) setupControllerWithURL: (NSURL) fileURL
usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {
UIDocumentInteractionController *interactionController =
[UIDocumentInteractionController interactionControllerWithURL: fileURL];
interactionController.delegate = interactionDelegate;
return interactionController;
}
于 2013-09-23T09:37:07.043 回答
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];
}
使用此代码我在whatsapp上发送以下字符串
于 2014-01-29T11:53:29.733 回答
0
我不确定你的意思,但也许这就是你要找的: 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];
}
于 2013-07-17T20:39:30.750 回答
0
于 2014-04-03T17:37:45.697 回答