Faisal Misle
Faisal Misle

Reputation: 3

Detect if iOS app is installed from within another app

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

Answers (1)

Wain
Wain

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

Related Questions