【发布时间】:2020-05-21 21:01:15
【问题描述】:
我的应用中有一个菜单按钮。如果用户单击此按钮,他会看到 UIAlertView,其中包含指向 App Store 的应用链接。
代码如下:
@IBAction func navButton(_ sender: AnyObject) {
let alertController = UIAlertController(title: "Menu", message: "Thanks for using our app!", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Rate Us on the App Store", style: .default, handler: { (action: UIAlertAction) in
print("Send user to the App Store App Page")
let url = URL(string: "itms-apps://itunes.apple.com/app/id")
if UIApplication.shared.canOpenURL(url!) == true {
UIApplication.shared.openURL(url!)
}
}))
我知道在 iOS 10.3 中,有机会在应用程序中设置评级。我应该更改什么,以便当用户单击 UIAlertView 中的链接时,他可以在应用程序中设置评分?
我在 Apple Developer 网站 (https://developer.apple.com/reference/storekit/skstorereviewcontroller) 上找到了一些信息,但我不知道如何在我的应用中执行此操作。
【问题讨论】: