目的

iRate库通过激励用户去AppStore打分,来帮助你提升iPhone和Mac App的质量。这是取得经常使用的目标用户的意见的最好的方式之一。

方案(小弟想说的重点)

以前,App中都是显示的添加“去打分”功能项。但是由于苹果审核人员工作的时候会根据心情,判断是否有“引导用户打分行为”而Reject咱辛苦搞好的App,所以建议把“去打分”功能项隐藏。

用别人的库还是得看懂源码,要不真不放心,对吧?!

别的地方都可以不看,唯独shouldPromptForRating这个方法必须看,用于判断是否满足提醒条件。

有两套方案可以玩:

方案1:

通过配置iRate,在App启动的时候检查配置和AppStore,来进行判断是否需要弹出打分提醒。采用此方案,无需对iRate源码进行剪裁,但是每次启动都要检查AppStore,自定义能力较差。

方案2:

通过配置iRate,去掉检查AppStore的部分,根据自己服务端提供的信息,来判断是否需要弹出打分提醒。采用此方案,灵活性较高,App在审核中可以通过服务端关掉提醒,待通过审核后放开提醒。

支持的 OS & SDK 版本

支持环境- iOS 8.3 / Mac OS 10.10 (Xcode 6.1, Apple LLVM compiler 6.1)

ARC 支持

从1.7开始,iRate需要使用ARC。如果你在使用非ARC项目,只需要在iRate.m上添加“-fobjc-arc”编译标志(Build Phases->Compile Sources->双击iRate.m->添加-fobjc-arc)

安装

集成iRate时,只需要添加iRate.h,.m,.bundle三个文件到项目中,如果不在乎本地化也可以忽略.bundle文件。

iRate是典型的安全不用配置,就可以简单的运行起来,内部是通过应用的bundle ID到AppStore中查找AppID。

如果想自定义iRate,最好在App完成启动之前,最简单的方式是添加配置代码到AppDelegate的initialize方法中:(本人不推荐放在这里,建议放到完全启动完App后进行)

#import "iRate.h"

+ (void)initialize
{
//configure iRate
[iRate sharedInstance].daysUntilPrompt = 5;
[iRate sharedInstance].usesUntilPrompt = 15;
}

配置项

可以通过配置iRate中的相关属性,来影响提醒弹出的行为,主要是

@property (nonatomic, assign) float daysUntilPrompt;//启动几次后开始弹出,默认10次

@property (nonatomic, assign) NSUInteger usesUntilPrompt;//使用几次后开始弹出,默认10次

@property (nonatomic, assign) NSUInteger eventsUntilPrompt;//发生几次事件后弹出,默认是10次,不是启动事件,相当于自定义事件

@property (nonatomic, assign) float usesPerWeekForPrompt;//每周最多弹出几次

@property (nonatomic, assign) float remindPeriod;//选择“稍后提醒我”后的再提醒时间间隔,默认是1天

@property (nonatomic, copy) NSString *messageTitle;//提醒框的title

@property (nonatomic, copy) NSString *message;//提醒消息

@property (nonatomic, copy) NSString *updateMessage;//已经打过分的用户的提醒消息

@property (nonatomic, copy) NSString *cancelButtonLabel;//取消按钮文字(命名明显不规范)

@property (nonatomic, copy) NSString *rateButtonLabel;//去提醒按钮文本

@property (nonatomic, copy) NSString *remindButtonLabel;//稍后提醒我按钮文本

@property (nonatomic, assign) BOOL useAllAvailableLanguages;//是否支持本地化

@property (nonatomic, assign) BOOL promptForNewVersionIfUserRated;//每个版本都弹出提醒

@property (nonatomic, assign) BOOL onlyPromptIfLatestVersion;//只是最新版提醒

@property (nonatomic, assign) BOOL promptAtLaunch;//启动或者回到前台就尝试提醒

@property (nonatomic, assign) BOOL verboseLogging;//控制台输出log

@property (nonatomic, assign) BOOL useUIAlertControllerIfAvailable;//使用UIAlertController

高级特性

@property (nonatomic, strong) NSURL *ratingsURL;//打分页面的URL

@property (nonatomic, strong) NSDate *firstUsed;//第一次弹出时间,参考daysUntilPrompt设置

@property (nonatomic, strong) NSDate *lastReminded;//最后一次弹出提醒时间

@property (nonatomic, assign) NSUInteger usesCount;//当前版本弹出次数

@property (nonatomic, assign) NSUInteger eventCount;//当前版本事件次数

@property (nonatomic, readonly) float usesPerWeek;//当前版本每周弹出次数

@property (nonatomic, assign) BOOL declinedThisVersion;//用户是否拒绝当前版本打分请求

@property (nonatomic, assign) BOOL declinedAnyVersion;//用户是否拒绝所有版本打分请求,设置YES不提醒

@property (nonatomic, assign) BOOL ratedThisVersion;//当前版本是否已经打过分

@property (nonatomic, readonly) BOOL ratedAnyVersion;//之前版本都打过分

@property (nonatomic, assign) id<iRateDelegate> delegate;

方法接口

- (void)logEvent:(BOOL)deferPrompt;//发生事件进行添加

- (BOOL)shouldPromptForRating;//通过对上面各个配置参数的检查,返回YES可以提醒,NO不满足提醒条件

- (void)promptForRating;//弹出提醒

- (void)promptIfNetworkAvailable;//如果网络有效将检查AppStore的App信息

- (void)promptIfAllCriteriaMet;//检查shouldPromptForRating和promptIfNetworkAvailable方法是否满足

- (void)openRatingsPageInAppStore;//打开打分提醒AppStore页面

代理方法

iRateDelegate代理提供下面一些方法,通过这些方法,可以打断或重写相关方法来影响默认行为。所有方法都是可选的。这些方法跟上面的iRate方法有些关联,使用时注意。具体含义参考命名就可以了。

- (void)iRateCouldNotConnectToAppStore:(NSError *)error;

- (void)iRateDidDetectAppUpdate;

- (BOOL)iRateShouldPromptForRating;

- (void)iRateDidPromptForRating;

- (void)iRateUserDidAttemptToRateApp;

- (void)iRateUserDidDeclineToRateApp;

- (void)iRateUserDidRequestReminderToRateApp;

- (BOOL)iRateShouldOpenAppStore;

- (void)iRateDidOpenAppStore;

本地化

iRate支持很多语言的本地化,参见bundle,一些常用key:

static NSString *const iRateMessageTitleKey = @"iRateMessageTitle";
static NSString *const iRateAppMessageKey = @"iRateAppMessage";
static NSString *const iRateGameMessageKey = @"iRateGameMessage";
static NSString *const iRateUpdateMessageKey = @"iRateUpdateMessage";
static NSString *const iRateCancelButtonKey = @"iRateCancelButton";
static NSString *const iRateRemindButtonKey = @"iRateRemindButton";
static NSString *const iRateRateButtonKey = @"iRateRateButton";

注: 文章由我们iOS122的小伙伴 @笨儿高兴~ 整理,喜欢就一起参与: iOS122 任务池

iRate快速绕坑使用的更多相关文章

  1. thinkphp 5.0整合phpsocketio完整攻略,绕坑

    使用环境: thinkphp5.0 项目需求 前端下单,后台接受,并立即做出提示.例如:美团外卖,客户端下单成功后,商家端就会立即有接单语音提示. 开发环境 thinkphp5.0 phpsocket ...

  2. Java的从浅至深绕坑而行的学习

    package day02; /** * 1:java初学习,避免面试时一些HR挖的坑. * @author biexiansheng * */ public class Test02 { publi ...

  3. A short Glimpse to Spectral Sequences 快速入坑谱序列(英文)

    In this short paper with a few of page (but a lot of language mistake), I want to introduce the theo ...

  4. Windows SDK 8安装失败的绕坑办法

    安装win sdk 8,提示错误:管道正在被关闭. 查看安装log文件,有如下错误: Error 0x800700e8: Failed to write message type to pipe.Er ...

  5. Python这么强大, 怎样才能快速入坑?

    作为一种年轻的编程语言,Python为何能在短短几年的时间内就以迅雷不及掩耳之势驰骋编程界?答案很简单,在人工智能时代,AlphaGo 都在使用的 Python语言,是最接近 AI 的编程语言. 随着 ...

  6. ant-design-vue 快速避坑指南

    ant-design-vue是蚂蚁金服 Ant Design 官方唯一推荐的Vue版UI组件库,它其实是Ant Design的Vue实现,组件的风格与Ant Design保持同步,组件的html结构和 ...

  7. iRate---一个跳转AppStore评分弹窗

    https://www.aliyun.com/jiaocheng/357479.html 摘要:gitHub地址:https://github.com/nicklockwood/iRate可以通过配置 ...

  8. Hexo博客skapp主题部署填坑指南

    相信大家都很喜欢 hexo skapp 的主题,由于作者采用结巴分词,加上需要依赖各种各样的环境 所以可能大家踩过很多坑,也许每个人踩得坑不一样,这里使用 Docker 容器 centos 来部署, ...

  9. 叶金荣:MySQL通用优化技巧

    转自:http://mp.weixin.qq.com/s?__biz=MjM5NDE0MjI4MA==&mid=208777870&idx=1&sn=6efddd6283e4d ...

随机推荐

  1. ColorCtr控制颜色渐变

    ColorCtr控制颜色渐变 public class ColorCtr : MonoBehaviour { public static global_color Instance;         ...

  2. [转]jquery的ajax交付时“加载中”提示的处理方法

    本文转自:http://www.educity.cn/wenda/77121.html jquery的ajax提交时“加载中”提示的处理方法    方法1:使用ajaxStart方法定义一个全局的“加 ...

  3. DP:凑零钱问题/最长非降子序列(C++)

    你给出一定数额的钱 i 元给我,我利用手中的硬币(m元, j元, k元...)兑换等值的钱给你,要求硬币数最少. 举例:给出1-11的钱,手中硬币有1元,3元,5元. 重点是找到状态和状态转移方程. ...

  4. Xtrareport绘制行号

    需要是用事件beforePrint (在打印数据之前的事件) private void xrTableCell12_BeforePrint(object sender, System.Drawing. ...

  5. $.ajax、$.post

    jQuery.post( url, [data], [callback], [type] ) :使用POST方式来进行异步请求 参数: url (String) : 发送请求的URL地址. data ...

  6. 【踩坑】报错 non-static method xxx() cannot be referenced from a static context

    今天测试代码时遇到 Error:(6, 55) java: non-static method sayGoodbye() cannot be referenced from a static cont ...

  7. css 引入方式以及css的选择器

    一.css的引入方式: 1.行内样式 <div> <p style="color: red">我是一个段落</p> </div> 2 ...

  8. Kindeditor单独调用多图上传

    html代码: <input type="button" id="J_selectImage" value="图片上传" />& ...

  9. 零基础逆向工程40_Win32_14_枚举窗口_模拟鼠标键盘

    1 查找窗口 1.1 代码案例 //查找指定窗口 TCHAR szTitle[MAX_PATH] = {0}; HWND hwnd = ::FindWindow(TEXT("#32770&q ...

  10. System Center Configuration Manager 2016 必要条件准备篇(Part2)

    步骤2.下载并安装Windows ADK.WDS组件 注意:在Configuration Manager服务器(CM16)上以本地管理员身份执行以下操作 当我们使用Configuration Man ...