Reputation: 3
I have a button on my iOS app that will launch a third party app via deeplinking, but if said app is not installed, the button will not do anything.
How can I check if the app is installed first, if not, prompt the user to download it?
Button code:
@IBAction func didTapEdmodo(sender: AnyObject) {
UIApplication.sharedApplication().openURL(NSURL(string: "edmodo://")!)
}
Upvotes: 0
Views: 1975
Reputation: 119031
You can call canOpenURL:
to check. Note that you need to declare the URL scheme in your info.plist before you can make the request. This is done using the LSApplicationQueriesSchemes
key.
Upvotes: 5