Categories
Code iOS

Requesting reviews in iOS with SKStoreReviewController

If you don’t ask, you don’t get

Someone who’d not heard of bad App Store reviews

Use iOS APIs to ask your user to leave you a review – just like asking anyone for anything, you should try to do this when they’re in a good place. For example, tie it in to your user adding a photo or selecting a favourite.

First, import StoreKit:

import StoreKit

StoreKit has a requestReview() method which limits the request so your users aren’t bombarded with requests – for this reason, you shouldn’t attach the request to a button saying “Leave a review” or anything like that. iOS will decide when to show the request, and you should just let it do its thing.

In iOS 14, you’ll need to provide a scene parameter to the method, like so:

SKStoreReviewController.requestReview(in: scene)

That’s literally all you need to do.

I use this extension to grab the active scene in my apps:

extension UIApplication {
    var currentScene: UIWindowScene? {
        connectedScenes
            .first { $0.activationState == .foregroundActive } as? UIWindowScene
    }
}

Happy review requesting!