如何以编程方式检查并打开iOS 8中的现有应用程序?

如何以编程方式检查并打开iOS 8中的现有应用程序?,第1张

概述我想检查一个应用程序是否存在于我的 iphone中.如果现在我想启动它,请打开应用程序的App Store链接. 请建议所需的参数,以实现它. 我有App Store链接打开应用程序,但我需要检查应用程序是否已经存在于手机中. 尝试这个代码 快速2.2 @IBAction func openInstaApp(sender: AnyObject) { var instagramHooks = 我想检查一个应用程序是否存在于我的 iphone中.如果现在我想启动它,请打开应用程序的App Store链接.

请建议所需的参数,以实现它.

我有App Store链接打开应用程序,但我需要检查应用程序是否已经存在于手机中.

解决方法 尝试这个代码

快速2.2

@IBAction func openInstaApp(sender: AnyObject) {    var instagramHooks = "instagram://user?username=your_username"    var instagramUrl = NSURL(string: instagramHooks)    if UIApplication.sharedApplication().canopenURL(instagramUrl!)    {        UIApplication.sharedApplication().openURL(instagramUrl!)    } else {        //redirect to safari because the user doesn't have Instagram        println("App not installed")        UIApplication.sharedApplication().openURL(NSURL(string: "https://itunes.apple.com/in/app/instagram/ID389801252?m")!)    }}

迅速3

@IBAction func openInstaApp(sender: AnyObject) {    let instagramHooks = "instagram://user?username=your_username"    let instagramUrl = URL(string: instagramHooks)    if UIApplication.shared.canopenURL(instagramUrl! as URL)    {        UIApplication.shared.open(instagramUrl!)    } else {        //redirect to safari because the user doesn't have Instagram        print("App not installed")        UIApplication.shared.open(URL(string: "https://itunes.apple.com/in/app/instagram/ID389801252?m")!)    }}
总结

以上是内存溢出为你收集整理的如何以编程方式检查并打开iOS 8中的现有应用程序?全部内容,希望文章能够帮你解决如何以编程方式检查并打开iOS 8中的现有应用程序?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1095462.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存