【问题标题】:share content on whatsapp iphone app xcode在whatsapp iphone app xcode上分享内容
【发布时间】:2017-04-16 02:37:12
【问题描述】:

现在正在寻找超过 2 个月的答案..请帮助

我正在使用 webview 来创建我的 ios 应用程序,并且在我的移动网站中有一个 whatsapp 共享按钮,它可以将内容共享到 whatsapp 并且它在任何浏览器上都可以正常工作,对于 android 应用程序,我已经实现了使其工作的代码..

这是我网站上的 whatsapp 代码:

href="whatsapp://send" data-text="内容在这里" data-href="" class="wa_btn wa_btn_s" style="display:none">分享

这就是我在我的 xcode 中使用的内容

func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool { if (request.url!.scheme == "whatsapp") { let wurl = URL(string: "whatsapp://")!

    if #available(iOS 10.0, *) {
        UIApplication.shared.open(wurl, options: [:], completionHandler: nil)
    } else { UIApplication.shared.openURL(wurl) 
    } 
    return false
}
return true
}

它会打开whatsapp,但如果我这样使用它就没有内容:

字符串:“whatsapp://sendtext="hello world"

它分享你好世界,但我想分享来自网站的内容。

感谢您的帮助

【问题讨论】:

  • 请修正您的问题,应该是:whatsapp://send?text=hello%20world

标签: ios iphone xcode webview uiwebview


【解决方案1】:

如果您想通过 Mobile-Web 通过 Whatsapp 分享网站页面,您应该使用以下字符串:

whatsapp://send?text=http://www.yourwebsite.com

使用文本中的网页链接将允许 Whatsapp 从网站(图标/描述..等)获取元数据并在消息中使用它。

【讨论】:

  • 这将分享我的页面yourwebsite.com.. 但我想分享当前页面..
  • 您可以在“文本”字段中设置您想要的任何页面。您应该知道上下文并共享当前页面。
  • 感谢回复,这是在我的 wordpress 网站上分享的 whatsapp href="whatsapp://send" data-text="content goes here" data-href="" class=" wa_btn wa_btn_s" style="display:none">分享我想在 iphone 应用程序上分享相同的内容。你能告诉我我应该在应用程序中写什么吗?
  • 试试这个:yourwebpage.com/test/test.html" data-action="share/whatsapp/share">
  • 是的,我已经在我的html页面中完成了这个,现在如何在xocde中实现?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-03
  • 1970-01-01
  • 2014-12-17
相关资源
最近更新 更多