i need to open an external app from my app, my backend give me data like com.whatsapp
or com.facebook.Facebook
etc .
when I look for this on the internet , it suggests answers using url scheme like whatsapp:// .. but it is not what I need.
this is my code
func openApp(app : String) {
if let url = URL(string: app),
UIApplication.shared.canOpenURL(url) {
if #available(iOS 10, *) {
UIApplication.shared.open(url, options: [:], completionHandler:nil)
} else {
UIApplication.shared.openURL(url)
}
} else {
customAlert(title: "error", message: "Failed to open \(app)")
}
}