12

对于 iPhone 应用程序,是否可以在产品上添加 Whatsapp 链接?一旦链接它会通过whatsapp向我的手机号码发送一条消息。请指教。

4

4 回答 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

你应该看看下面的链接

http://handleopenurl.com/scheme/833

它将为您提供所有应用程序的所有开放 url 方案选项,您也可以注册您的应用程序。

于 2014-04-03T17:37:45.697 回答