[英]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. 我的iOS应用程序上有一个按钮,该按钮将通过深度链接启动第三方应用程序,但是如果未安装该应用程序,则该按钮将无任何作用。
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://")!)
}
You can call canOpenURL:
to check. 您可以调用
canOpenURL:
进行检查。 Note that you need to declare the URL scheme in your info.plist before you can make the request. 请注意,在发出请求之前,需要在info.plist中声明URL方案。 This is done using the
LSApplicationQueriesSchemes
key. 这是使用
LSApplicationQueriesSchemes
键完成的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.