问题
I wish to add some sort of a "Write a Review" or "Rate Us" feature to my app so my customers can easily rate and review my app.
Best practice I can think of is to have some sort of pop-up or open a UIWebView within my app so the user is not kicked off of my app while opening the App Store application as done in:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/myAppName"]];
Does anyone knows of a way to do that?
回答1:
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 uialertview and storekit 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.
- Import the header in your AppDelegate:
#import "iRate.h"
- Add the StoreKit Framework to your project - More on StoreKit from Apple Documentation
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.
回答2:
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.
来源:https://stackoverflow.com/questions/6736189/how-to-add-write-a-review-rate-us-feature-to-my-app