Below code snippet will open the reviews & ratings section on native AppStore app
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)
}
}
}
call this function using application identifier
self.showAppReivewScreen("951627022")