Detect if iOS app is installed from within another app

我的未来我决定 提交于 2019-12-20 06:30:22

问题


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://")!)
}

回答1:


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.



来源:https://stackoverflow.com/questions/36988875/detect-if-ios-app-is-installed-from-within-another-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!