我看到一些关于 SKStoreProductViewController
的教程,比如:
Open a list of my apps in the App Store within my App
但是,它总是在启动时以“详细信息”打开 SKStoreProductViewController
,如何以编程方式打开“评级和评论”
最佳答案
下面的代码片段将打开原生 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")
关于ios - skstoreproductviewcontroller : how to open "rating and review" at launch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15096345/