-2

Is there a function which I can use to check if the user has a particular app installed on their device. Ie, instagram

Jase Whatson
  • 4,179
  • 5
  • 36
  • 45

1 Answers1

6
class func isAppInstalled(_ appName:String) -> Bool{

    let appScheme = "\(appName)://app"
    let appUrl = URL(string: appScheme)

    if UIApplication.shared.canOpenURL(appUrl! as URL){
        return true
    } else {
        return false
    }

}

Add the name of the app you are checking to LSApplicationQueriesSchemes in your info.plist file

enter image description here

Jase Whatson
  • 4,179
  • 5
  • 36
  • 45