且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在iOS上检查用户的设备上是否安装了特定的应用程序?

更新时间:2022-03-14 16:48:10

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
    }

}

将您正在检查的应用程序的名称添加到info.plist文件中的LSApplicationQueriesSchemes