NEW: Master Swift design patterns with my latest book! >>

How to ask users to review your app using SKStoreReviewController

Written by Paul Hudson    @twostraws

Many apps ask users to review their apps, but it’s increasingly common to see dark patterns such as apps pre-screening users so they get sent to the App Store only if they said they like the app.

To avoid this problem in the future, and also to provide a standardized interface that users can trust, iOS 10.3 brought a built-in way to ask users to review the app, and it couldn’t be much easier to use.

But first, some important information:

  1. You request that the system show a review dialog, which means the request might be ignored based on internal logic known only to Apple.
  2. Because the request might be ignored, you should not trigger the request from a user-facing button saying something like “Leave a review” – it might appear to do nothing at all.
  3. When you are in development, requesting a review will always show the review user interface, but you can’t submit an actual review.
  4. When you are using TestFlight to test your app, requesting a review will do nothing at all.

Once you understand those rules, the process really couldn’t be easier. First, add this import to your code:

import StoreKit

Then at some point in your app call this method:

SKStoreReviewController.requestReview()

That’s it!

Again, you should not call that in response to user input, although if you have any sense you won’t just put it inside viewDidAppear() in your app.

Instead, consider storing a simple run count for your app using UserDefaults, then calling the method after your app has been run 10 times. By that point it’s pretty clear the user keeps coming back to your app, so hopefully you have more chance of getting a positive review!

Available from iOS 10.3

Did this solution work for you? Please pass it on!

Other people are reading…

About the Swift Knowledge Base

This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.

Swift on the server is here

Get ahead of the game and learn server-side Swift with my latest book – build real-world projects while you learn!

Click here to visit the Hacking with Swift store >>