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
I know this is an old question, but the following worked for me (I'm using xcode 8.3.3 and swift 3).
I added whatsapp query scheme inside Info.plist.
LSApplicationQueriesSchemes
whatsapp
Info.plist
After adding it, the following works:
let urlString = "whatsapp://send?text=Message to share"
let urlStringEncoded = urlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
let URL = NSURL(string: urlStringEncoded!)
if UIApplication.shared.canOpenURL(URL! as URL) {
UIApplication.shared.openURL(URL! as URL)
}