Monday, 15 July 2019

Open WhatsApp in iOS




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

Difference between == and ===

Difference between == and === https://stackoverflow.com/questions/24002819/difference-between-and == operator checks if their ...