如何添加“写评论"/“给我们打分"我的应用程序的功能?

How to Add quot;Write a Reviewquot; / quot;Rate Usquot; Feature to My App?(如何添加“写评论/“给我们打分我的应用程序的功能?)

本文介绍了如何添加“写评论"/“给我们打分"我的应用程序的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的应用中添加某种写评论"或给我们评分"功能,以便我的客户可以轻松地对我的应用进行评分和评论.

我能想到的最佳做法是在我的应用中弹出某种弹出窗口或打开 UIWebView,这样用户在打开 App Store 应用时不会被踢出我的应用,如下所示:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/myAppName"]];

有人知道怎么做吗?

解决方案

StoreKit API(iOS 10.3 及以上)

从 iOS 10.3 开始,StoreKit API 提供了一种无需离开您的应用即可在 App Store 上请求评论的方法.当被调用时,系统可以向用户呈现请求审查的警报.用户可以直接在警报内提供星级评级,继续撰写评论或关闭警报.StoreKit 几乎可以为您处理一切.要提交审核请求,请在您的应用中的适当位置进行以下调用:

//Objective-C[SKStoreReviewController requestReview]//斯威夫特SKStoreReviewController.requestReview()

根据 Apple 的说明,您不应调用这些来响应直接的用户交互(即点击显示写评论"的按钮),因为它可能并不总是显示警报.实际上,警报可能每 365 天仅显示 3 次.

<块引用>

重要提示:虽然这看起来相当简单,但您仍然需要编写某种逻辑来分隔提示.例如,仅在 X 次启动、天数或重大事件后才显示提示.

如果你没有做到这一点,只是将评论提示贴在任何地方(例如,viewDidAppear 调用),你的用户会非常恼火,因为他们会很快地反复看到它.然后,他们要么留下差评(因为他们很生气),要么整整一年都没有被要求再次评论.

以下是警报外观的示例.有关详细信息,请参阅

<小时>

iRate(iOS 7.0 及更高版本)

如果您的应用在低于 10.3 的 iOS 版本上运行您需要更强大地控制向用户请求评分,iRate 是一个很好的解决方案.

对于 iOS 10.3 或更高版本的设备,iRate 使用上述 StoreKit API.对于运行 iOS 7.0 到 10.2 的设备,iRate 使用 uialertview 和 storekit 询问用户评分(或稍后提醒他们).一切都是可定制的,从取消按钮的标题到提醒用户的时间间隔.

默认情况下,iRate 会在满足某些要求时自动打开(例如应用启动 X 次,用户通过 X 关卡),但您也可以使用多种方法和您自己的逻辑(在 iRate 的帮助下方法)来手动显示 iRate 弹出窗口.

设置

要安装,只需将头文件、实现文件和 .bundle(用于本地化)拖到您的项目中.

  1. 在您的 AppDelegate 中导入标头:#import "iRate.h"
  2. StoreKit 框架添加到您的项目中 - 详细了解 Apple 文档中的 StoreKit
  3. 在您的 application:didFinishLaunchingWithOptions: 方法中,设置以下内容:

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

属性

以下属性可用于测试目的.在测试期间将其设置为 YES 以确保对话框正确显示.当设置为 YES 时,它将在启动时立即出现,而忽略其他显示设置.对于您的应用的发布版本,将此设置为 NO.

 [iRate sharedInstance].previewMode = NO;

appStoreID 属性允许您设置应用的 ID.仅当您的 Mac 和 iOS 应用程序具有相同的 Bundle Identifier 时才需要这样做.此处设置的 App ID 还必须与 Xcode 和 iTunes Connect 中设置的 Bundle ID 匹配:

[iRate sharedInstance].appStoreID = 555555555;

更多详情可在 iRate GitHub 页面上找到.

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?

解决方案

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.

Important Note: Although this seems fairly simple, you'll still need to write some kind of logic in order to space out your prompts. For example, to present the prompt only after X number of launches, days, or significant events.

If you fail to do this and just stick the review prompt anywhere (a viewDidAppear call, for example), your users will be rather annoyed because they'll see it pretty quickly and repeatedly. Then, either they leave a bad review (because they're annoyed) or aren't asked to review again for a whole year.

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.

  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.

这篇关于如何添加“写评论"/“给我们打分"我的应用程序的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何添加“写评论"/“给我们打分"我的应用程序的功能?

基础教程推荐