通过按钮打开AppStore [英] Open AppStore through button

查看:24
本文介绍了通过按钮打开AppStore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们能帮我把下面的代码翻译成 Swift 吗?

Could you guys help me to translate the following code into Swift?

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.apple.com/de/app/x-gift/id839686104?mt=8&uo=4"]];

(或者我必须使用这个链接:itms://itunes.apple.com/app/id839686104?)

(or do I have to take this link: itms://itunes.apple.com/app/id839686104?)

提前致谢!

推荐答案

这里.但我强烈建议你学习 Swift 的基础知识!

Here. But I highly suggest you learn the basics of Swift!

UIApplication.sharedApplication().openURL(NSURL(string: "itms://itunes.apple.com/de/app/x-gift/id839686104?mt=8&uo=4")!)

如果您想在 Swift 5 中打开 AppStore:

If you wanna open the AppStore in Swift 5:

if let url = URL(string: "itms-apps://apple.com/app/id839686104") {
    UIApplication.shared.open(url)
}

这篇关于通过按钮打开AppStore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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