【问题标题】:Whatsapp link on products?产品上的Whatsapp链接?
【发布时间】:2013-05-28 07:25:18
【问题描述】:

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

【问题讨论】:

    标签: iphone ios objective-c message whatsapp


    【解决方案1】:

    您可以使用 tafh 建议的自定义方法,或者作为 iOS 应用程序开发人员,我建议您使用文档交互控制器,初始化 UIDocumentInteractionController。这些都可以帮助您管理交互。查看下面的链接了解更多信息。

      (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];
      
      }
      

      使用此代码我在 whatsapp 上发送以下字符串

      【讨论】:

        【解决方案3】:

        我不确定你的意思,但也许这就是你要找的: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];
        }
        

        【讨论】:

          【解决方案4】:

          你应该看看下面的链接

          http://handleopenurl.com/scheme/833

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

          【讨论】:

            猜你喜欢
            • 2020-04-22
            • 1970-01-01
            • 2021-12-20
            • 2021-08-16
            • 2011-12-06
            • 2013-08-23
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多