Skip to content
DeveloperMemos

Asking for an App Rating with StoreKit

iOS, Swift, App Rating, StoreKit2 min read

Positive ratings and reviews are essential for the success and visibility of your iOS app on the App Store. Encouraging users to rate your app can greatly impact its popularity and user acquisition. With the StoreKit framework in iOS, you can easily prompt users to rate your app without leaving the app itself. In this article, we will explore how to ask for an app rating using StoreKit in Swift.

Configuring the StoreKit Framework

You shouldn't need to do any extra configuration to be able to import StoreKit(atlast as of XCode 14). If you're going to add purchases to your app you will need to make some changes to capabilities but that's out of the scope of this article.

Prompting for an App Rating

To prompt users to rate your app, you will use the SKStoreReviewController class provided by StoreKit. The SKStoreReviewController API makes it easy to display the standard App Store rating prompt.

Here's an example of how to ask for an app rating in Swift:

1import StoreKit
2
3func askForAppRating() {
4 if #available(iOS 10.3, *) {
5 SKStoreReviewController.requestReview()
6 } else {
7 // Fallback for older iOS versions
8 // Display a custom rating prompt or redirect the user to the App Store.
9 }
10}

In the example above, we first check if the current iOS version supports the SKStoreReviewController class using the #available directive. If the device is running iOS 10.3 or later, we call SKStoreReviewController.requestReview() to display the standard rating prompt. If the device is running an older iOS version, you can implement a custom rating prompt or redirect the user to the App Store page for your app.

By the way, the above method of calling requestReview without passing any parameters is actually deprecated. There's no issues with using it though. I still use this method in some of my apps because it's quite easy to call. If you want to keep up with deprecations the "new" way to call requestReview(if you use SwiftUI) looks like this:

1if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
2 SKStoreReviewController.requestReview(in: scene)
3}

Quite verbose huh...

Best Practices for Asking for App Ratings

While asking for app ratings can be beneficial, it's important to follow some best practices to ensure a positive user experience:

  1. Timing: Choose an appropriate time to ask for a rating. Consider waiting until the user has engaged with your app for a while, completed a significant task, or achieved a milestone.

  2. Frequency: Avoid asking for a rating too frequently. Bombarding users with rating prompts can lead to annoyance and potentially negative reviews. Be mindful of the user's experience and ask for a rating sparingly.

  3. In-App Context: Make sure to ask for a rating within your app's context. Prompt users while they are actively using your app to provide relevant feedback. Avoid interrupting the user's workflow or displaying the rating prompt at inappropriate moments.

  4. Politeness: Be polite and respectful when asking for a rating. Use a friendly and non-intrusive message that clearly explains the purpose of the prompt and emphasizes the user's feedback as valuable.

Closing Thoughts

Prompting users to rate your app using StoreKit is a powerful way to boost your app's ratings and reviews on the App Store. By following the guidelines and best practices mentioned in this article, you can improve user engagement, increase positive reviews, and enhance the overall success of your iOS app.

Remember to be considerate of your users' experience and avoid intrusive or excessive rating prompts(Apple limits the amount of times you can show a prompt inside a one year peroid anyways...). Strive to provide a seamless and enjoyable user journey while encouraging valuable feedback from your app's users!