从应用程序中启动雨燕的App Store [英] Launching App Store from App in Swift

查看:190
本文介绍了从应用程序中启动雨燕的App Store的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个应用程序,我有促进我的其他应用程序的一面旗帜。这是我的code:

I am creating an app, and I have a banner which promotes my other app. This is my code:

var barsButton : UIButton = UIButton(frame: CGRectMake((self.view.bounds.width / 2) - 51, self.view.bounds.height - 100, 102, 30))
barsButton.setImage(UIImage(named: "Bars Icon 2.png"), forState: .Normal)
barsButton.addTarget(self, action: "openBarsLink", forControlEvents: UIControlEvents.TouchUpInside)

func openBarsLink() {
    var barsLink : String = "itms-apps:https://itunes.apple.com/app/bars/id706081574?mt=8"
    UIApplication.sharedApplication().openURL(NSURL.URLWithString(barsLink))
}

然而,当用户presses按钮,它只是需要他们的应用程序商店,而不是特定的页面我的应用程序。我在做什么错了?

However, when the user presses the button, it just takes them to the App Store, and not the specific page for my app. What am I doing wrong?

推荐答案

您在你的URL的协议太多。摆脱 HTTPS的:这样的URL读

You have too many protocols in your URL. Get rid of https: so the URL reads

ITMS-应用://itunes.apple.com/app/bars/id706081574

这篇关于从应用程序中启动雨燕的App Store的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆