I have a Web page with an anchor that has href=\"whatsapp:+(xxxxxxxxx)\", if i click on it on my iPhone (iOS 9), it opens WhatsApp in the chat view for that contact (i can s
working fine with xcode 8.3.2 and swift 3
let date = Date()
let msg = "Hi my dear friends\(date)"
let urlWhats = "whatsapp://send?phone=phoneNumber&abid=phoneNumber&text=hi"
if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {
if let whatsappURL = NSURL(string: urlString) {
if UIApplication.shared.canOpenURL(whatsappURL as URL) {
UIApplication.shared.openURL(whatsappURL as URL)
} else {
print("please install watsapp")
}
}
}