How to open WhatsApp from Swift app?

前端 未结 5 1670
无人共我
无人共我 2021-02-03 15:51

I am using webview for my Swift app and I have \"Share on WhatsApp\" button on my website which works fine on a browser. But on iPhone app, when I click on the butt

5条回答
  •  爱一瞬间的悲伤
    2021-02-03 16:21

    Here is a simple answer I use in a switch structure. This loads whatsApp. I am still looking for a way to call a specific contact.

    case "whatsApp":
            let usefullWhere: String = "whatsapp://?app"//
            let url = NSURL(string: usefullWhere)!
            UIApplication.sharedApplication().openURL(url)
    

提交回复
热议问题