How to Add “Write a Review” / “Rate Us” Feature to My App?

喜欢而已 提交于 2019-12-02 14:04:40

StoreKit API (iOS 10.3 and up)

As of iOS 10.3, the StoreKit API provides a way to request a review on the App Store without leaving your app. When called, the system may present the user with an alert that requests a review. The user may provide a star rating directly inside the alert, continue on to write a review, or dismiss the alert. StoreKit handles just about everything for you. To present the review request, make the following call where it is appropriate in your app:

// Objective-C
[SKStoreReviewController requestReview]

// Swift
SKStoreReviewController.requestReview()

As per Apple's instructions, you should not call these in response to a direct user-interaction (i.e. tapping a button that says "Write a Review") because it may not always display the alert. Indeed, the alert may only be displayed three times every 365 days.

Below is an example of what the alert looks like. For more information, see Apple's documentation.


iRate (iOS 7.0 and up)

If your app runs on versions of iOS earlier than 10.3 or you need more robust control over requesting ratings from users, iRate is a good solution.

For devices with iOS 10.3 or greater, iRate uses the aforementioned StoreKit API. For devices running iOS 7.0 to 10.2, iRate uses a and to ask the user for a rating (or to remind them later). Everything is customizable, from the title of the Cancel button to the interval at which it reminds the user.

By default, iRate automatically opens when certain requirements are met (e.g. app launched X number of times, user passed X number of levels), but you can also use a variety of methods and your own logic (with the help of iRate methods) to manually display an iRate popup.

Setup

To install, just drag the header file, the implementation file, and the .bundle (for localization) into your project.

  1. Import the header in your AppDelegate: #import "iRate.h"
  2. Add the StoreKit Framework to your project - More on StoreKit from Apple Documentation
  3. In your application: didFinishLaunchingWithOptions: method, set the following:

    // Configure iRate
    [iRate sharedInstance].daysUntilPrompt = 5;
    [iRate sharedInstance].usesUntilPrompt = 15;
    

Properties

The property below is useful for testing purposes. Set it to YES during testing to make sure the dialog appears properly. When set to YES it will appear immediately on startup, disregarding other display settings. Set this to NO for release versions of your app.

 [iRate sharedInstance].previewMode = NO;

The appStoreID property allows you to set the ID of your app. This is only required if you have both Mac and iOS apps with the same Bundle Identifier. The App ID set here must also match the Bundle ID set in Xcode and iTunes Connect:

[iRate sharedInstance].appStoreID = 555555555;

More Details are available on the iRate GitHub page.

A really good one I use is Appirater: https://github.com/arashpayan/appirater/

It automatically prompts your users to leave reviews, you just have to provide your app id.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!