8

I'm using this code to rate app from an ios application.

let appLink = "https://itunes.apple.com/us/app/[name of the app]/id[idnumber]?mt=8"
let url = URL(string: appLink)
UIApplication.shared.openURL(url!)

the problem is Safari says "the page address is invalid"

Is there any way to make it work? I'm using xcode 9 and swift 4

soer
  • 147
  • 1
  • 9
  • Possible duplicate of [How to link to apps on the app store](https://stackoverflow.com/questions/433907/how-to-link-to-apps-on-the-app-store) – GeneCode Oct 06 '17 at 03:07

2 Answers2

10

Your URL can simply be:

https://itunes.apple.com/app/id<App ID Here>?mt=8

Better yet, use SKStoreProductViewController so you can show the app in an App Store page without the need to leave your app.

And as of iOS 10.3 you can SKStoreReviewController specifically to allow a user to post a review or rate an app.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
1

Use the STORE KIT request review based on the new guidelines and documentation found here.

https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview

On older version you can use

itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=<AppId>&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software
Vig
  • 1,532
  • 1
  • 12
  • 28