Skip to content

Instantly share code, notes, and snippets.

@JazonBD
Last active December 6, 2017 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JazonBD/265725bb40dc016a7d9629291da39b47 to your computer and use it in GitHub Desktop.
Save JazonBD/265725bb40dc016a7d9629291da39b47 to your computer and use it in GitHub Desktop.
Simple example of SKStoreReviewController use.
func requestUserReview() {
if #available(iOS 10.3, *) {
SKStoreReviewController.requestReview()
return
}
// Old approach using UIApplication.
let appIdString = "idXXXXXXXXX" // Your App ID ;)
let appStoreUrlString = "itms-apps://itunes.apple.com/app/\(appIdString)"
let appStoreUrl = URL(string: appStoreUrlString)
guard let url = appStoreUrl else {
return
}
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
// Instance method openURL(_:) is deprecated, use only in older iOS versions.
UIApplication.shared.openURL(url)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment