我们常常看到市面上有很多 App,每用个一段时间就会弹出个框,问你是否要去 AppStore 上给它打个分。如果你选择是的话,就会自动打开 AppStore,并显示这个应用的首页,用户便可以在这里撰写评论并打分了。
这个其实很简单,只需要通过 UIApplication.sharedApplication().openURL() 方法打开相应应用的 App Store 链接即可。除了跳转到 App Store,openURL 还要其它许多用法,具体参考我原来写的这篇文章:Swift - 打开第三方应用,并传递参数(附常用App的URL Scheme)
1,样例效果图
当程序启动的时候会弹出消息框询问是否去评价。点击“好的”即跳转到这个应用的 AppStore 页面。

2,样例代码
链接地址的末尾是你要跳转到的应用的 appID,这个是你提交 app 时候自动生成的,也是 AppStore 中的唯一的 ID(作为演示,这里我就使用 QQ 的 appID)。
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(animated: Bool) {
//弹出消息框
let alertController = UIAlertController(title: "觉得好用的话,给我个评价吧!",
message: nil, preferredStyle: .Alert)
let cancelAction = UIAlertAction(title: "暂不评价", style: .Cancel, handler: nil)
let okAction = UIAlertAction(title: "好的", style: .Default,
handler: {
action in
self.gotoAppStore()
})
alertController.addAction(cancelAction)
alertController.addAction(okAction)
self.presentViewController(alertController, animated: true, completion: nil)
}
//跳转到应用的AppStore页页面
func gotoAppStore() {
let urlString = "itms-apps://itunes.apple.com/app/id444934666"
let url = NSURL(string: urlString)
UIApplication.sharedApplication().openURL(url!)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
labubu官网购买直达-labubu官网最新价格
漫蛙manwa漫画官方入口-漫蛙漫画app2026免费极速下载
Nano-banana-pro官网直连入口-Nano-Banana-2国内精准直达链接
小鸡漫画官方客户端下载入口在哪安装最新版本-小鸡漫画下载安卓版安装教程免费看
Nano-banana-pro官网直达入口-Nano-banana-pro网页版快捷登录
秘塔网页版官方入口-秘塔官网登录快捷通道