Mallow's Blog

How to add in app rating to your app in iOS 10.3

Prior to iOS 10.3 we need to navigate the user to app store for getting rating/review of our app. By this getting a review/rating from an user is less and it also makes the user annoyed and reduces the engagement of the app. When the user is redirected to the app store there is a high chance for them to quit the app and browse further.  But in iOS 10.3 onwards no need to navigate the user to App Store to get the rating/review. Apple have added new api called SKStoreReviewController in StoreKit framework to get the in-app rating/review. Let’s get dive in detail.

 

Keep in mind:

  1. In development mode the rating/review feature will work until showing view to get the rating for testing UI and user experience. But the actually process of updating user rating/review in App Store will not happen, because you didn’t uploaded your app in App Store yet.
  2. This rating/review feature will not have any effect to the app which is distributed via test flight.
  3. We need to call one single method to show the view for getting rating/review, the remaining work will be handled by OS itself.
  4. In addition, we can automatically open the review page of your app in app store, you can simply append the query parameter action=write-review to your product URL, in app configuration place from your app. This link will directly take the user to review page in App Store.

 

Do’s and Dont’s:

Before implementing the in-app review/rating, apple have suggesting simple do’s and dont’s. The view showing for getting the in app rating/review screen is fully governed by App Store policy of our app. So there may be a chance to not display the review/rating screen. So it would be better if we follow following Do’s and Dont’s.

Do’s:

  •  We need to find the perfect place to get rating/review from user. The way you are asking the rating/review for your app should not affect user experience.

Dont’s:

  • We should not asking rating/review from user in response of user action(For example: button action, switch action, etc.)
  • We should not ask rating/review when the user opens the app.
  • We should not ask user to rating/review your app frequently.

Things need before coding:

  • Xcode 8.3
  • iPhone Device with iOS 10.3 and above(10.3.1 is also released)(We can test rating in iOS 10.3 simulator, but for testing review we need device)

Let’s start coding:

  • Create single view application in Xcode 8.3
  • Name your project with appropriate name. Here i’m giving my project name as “RateMeHere”.
  • Here we are simply going to present the rating screen from viewDidAppear method. (For better user experience choose the best place to ask rating, again this is only for demo so i’m doing it from viewDidAppear method of my ViewController.swift class.)
  • Open your ViewController.swift file.
  • Import StoreKit  framework in that class
  • Add viewDidAppear method in ViewController class,.
  • Add following line in viewDidAppear method.
 SKStoreReviewController.requestReview() 
  • Our final code will look like this
import UIKit
import StoreKit
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
SKStoreReviewController.requestReview() // Requesting alert view for getting rating from the user.
}
}
  • Just build and run your project you will see the alert for asking rating for your app.

    Let’s implement logic to take user directly to App Store review page of our app. As per apple says they will handle the things to get rating and review from user. If we want we can do it as additional to take user directly to review page of our app in App Store.

  • To automatically open the review page of our app in App store, we need to append action=write-review query parameter with our product url.
  • Lets add one button in storyboard and give constraint to make it as centre in screen. Have a look into below image for reference.

  • Create action for button from storyboard to your ViewController.swift class.
  • Enter following logics inside the action method to open app’s review page directly.

Note: Change with your product url instead of <Your product url> in below code. Then append query parameter at the end of your url to open review page directly. See below code.

@IBAction func reviewMeButtonPressed(_ sender: Any) {
if let url = URL(string: "&lt;Your product url&gt;?action=write-review") {
UIApplication.shared.open(url, options: [:], completionHandler: { (status) in
if status {
print("Success")
} else {
print("Failed")
}
})
}
}
  • Run your app in device
  • The app rating screen will present when viewDidAppear calls.
  • The review page will open once you click your button, which we added a minute back.

In this post we have seen the advantages of in app review feature and how to add that in iOS 10.3. In the upcoming posts we will see the other features that has been introduced in 10.3.

 

Karthick S,
Junior iOS Developer,
Mallow Technologies.

3 Comments

  1. Arnon Rodrigues

    Thanks!! Too much useful!

    1. Gopal

      Welcome !!

  2. Himani

    I want to prompt user to provide feedback with-in the app but i could not find any documentation to open in-app feedback modal. Is there any api like SKStoreReviewController to show in-app feedback modal? I’tried implementing the url with action=write-review on iOS 11 which redirects to the app store page. Can anyone help on how to implement in-app feedback functionality?

Leave a Reply

%d bloggers like this: