通过按钮打开AppStore [英] Open AppStore through button
本文介绍了通过按钮打开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屋!
查看全文