skstoreproductviewcontroller:如何在启动时打开“评级和评论”

时间:2013-02-26 18:17:34

标签: ios rating storekit review

我看到了一些关于SKStoreProductViewController的教程,例如: Open a list of my apps in the App Store within my App

但是,它会在启动时打开SKStoreProductViewController并显示“详细信息”,如何以编程方式打开“评分和审核”

1 个答案:

答案 0 :(得分:-1)

以下代码段将打开评论&本地AppStore应用程序的评级部分

struct AppStoreURLs {
    static let templateReviewURLiOS8 = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%@&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software"
}


func showAppReivewScreen(_ appId: String?)  {

        guard let applicaitonIdentifier = appId, (applicaitonIdentifier.isEmpty == false) else { return }

                let reivewURL = String(format: AppStoreURLs.templateReviewURLiOS8, applicaitonIdentifier)

        if let url = URL(string: reivewURL), UIApplication.shared.canOpenURL(url) {

            if #available(iOS 10.0, *) {
                UIApplication.shared.open(url, options: [UIApplicationOpenURLOptionUniversalLinksOnly : false], completionHandler: nil)
            } else {
                UIApplication.shared.openURL(url)
            }
        }

    }

使用应用程序标识符

调用此函数
self.showAppReivewScreen("951627022")