15

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

但是,它总是SKStoreProductViewController在启动时以“详细信息”打开,我如何以编程方式打开“评分和评论”

4

1 回答 1

-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")
于 2017-06-06T15:53:28.110 回答