【问题标题】:skstoreproductviewcontroller: how to open "rating and review" at launchskstoreproductviewcontroller:如何在启动时打开“评级和评论”
【发布时间】:2013-02-12 07:56:07
【问题描述】:
【问题讨论】:
标签:
ios
rating
storekit
review
【解决方案1】:
下面的代码 sn-p 将打开本地 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")