in info.plist file add this line
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp://</string>
</array>
if let whatappURL = URL(string: "https://api.whatsapp.com/send?phone=\(number)&text=\(msg)"),
UIApplication.shared.canOpenURL(whatappURL)
{
if #available(iOS 10.0, *) {
UIApplication.shared.open(whatappURL, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(whatappURL)
}
}
No comments:
Post a Comment