拿走即用之应用评价提醒irate

irate

  • 给应用做评价这个需求还是蛮普遍的,接下来就介绍下这个框架怎么应用,以及自己在工作中的自己写的类分享给大家。
  • 我自己做了两个版本,一个是irate自带的弹框,不做改变,一个是对irate自带的弹框的文字包括按钮的点击的效果做了变化,供大家参考。

irate原生弹框不做更改

  • 图片
原生弹框.png
  • 代码SCAppRateManager.h
#import 

/**
 * app评分管理
 */
@interface SCAppRateManager : NSObject 

#pragma mark -
+ (SCAppRateManager *)shareSCAppRateManager;
- (void)setup;
// 弹出评价提醒
+ (void)checkAndRate;

@end
  • 代码SCAppRateManager.m
#import "SCAppRateManager.h"
#import 

@interface SCAppRateManager () 

@end

@implementation SCAppRateManager

+ (SCAppRateManager *)shareSCAppRateManager
{
    static SCAppRateManager *__instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        __instance = [[SCAppRateManager alloc] init];
    });
    return __instance;
}

- (void)setup
{
    [iRate sharedInstance].delegate = self;
    // 初始化Appstore id
    [[iRate sharedInstance] setAppStoreID:您的appstoreID];
    // 启动或者回到前台就尝试提醒
    [iRate sharedInstance].promptAtLaunch = NO;
    // 每个版本都弹
    [iRate sharedInstance].promptForNewVersionIfUserRated = YES;
    // 使用几次后开始弹出
    [iRate sharedInstance].usesUntilPrompt = 3;
    // 多少天后开始弹出,默认10次
    [iRate sharedInstance].daysUntilPrompt = 3;
    // 选择“稍后提醒我”后的再提醒时间间隔,默认是1天
    [iRate sharedInstance].remindPeriod = 3;
    [iRate sharedInstance].declinedThisVersion = NO;
}

+ (void)checkAndRate
{
    if ([[iRate sharedInstance] shouldPromptForRating]) {
        [[iRate sharedInstance] promptForRating];
    }
}

- (void)iRateUserDidDeclineToRateApp
{
    [iRate sharedInstance].lastReminded = [NSDate date];
}

@end
  • 效果介绍:每个版本都会弹,使用三天后,至少使用三次后,弹出,选择“稍后在说”、“不,谢谢”后,会在三天后再次弹出,选择“去评价”会直接跳转到appstore这个应用的下载页面,而后这个版本不再弹出。下个版本,无论之前有没有评价,都会再次弹出。

irate自定义弹窗alert

  • 图片
自定义弹框.PNG
  • AppRateManager.h代码
#import 

/**
 * app评分管理
 */
@interface AppRateManager : NSObject

#pragma mark -
+ (AppRateManager *)shareAppRateManager;
- (void)setup;
// 弹出评价提醒
- (void)checkAndRateWithController:(UIViewController *)VC;

@end
  • AppRateManager.m代码
#import "AppRateManager.h"
#import "iRate.h"
// 反馈界面
#import "LXRMineFeedBackViewController.h"

@interface AppRateManager ()

@property (nonatomic, weak) UIViewController *VC;

@end

@implementation AppRateManager

+ (AppRateManager *)shareAppRateManager
{
    static AppRateManager *__instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        __instance = [[AppRateManager alloc] init];
    });
    return __instance;
}

- (void)setup
{
    [iRate sharedInstance].delegate = self;
    // 初始化Appstore id
    [[iRate sharedInstance] setAppStoreID:您的appstoreID];
    // 启动或者回到前台就尝试提醒
    [iRate sharedInstance].promptAtLaunch = NO;
    // 每个版本都弹
    [iRate sharedInstance].promptForNewVersionIfUserRated = YES;
    // 使用几次后开始弹出
    [iRate sharedInstance].usesUntilPrompt = 3;
    // 多少天后开始弹出,默认10次
    NSInteger firstRateAfterDays = 3;
    // 选择“稍后提醒我”后的再提醒时间间隔,默认是1天
    NSInteger interRateDays =  4;
    [iRate sharedInstance].declinedThisVersion = NO;
    NSString *rateTitle = @"给我评价";
    NSString *rateText =@"觉得这个app怎么样,喜欢就来评价一下唄";
    [iRate sharedInstance].messageTitle = rateTitle;
    [iRate sharedInstance].message = rateText;
    [iRate sharedInstance].updateMessage = rateText;
    [iRate sharedInstance].rateButtonLabel = @"喜欢,支持一下";
    [iRate sharedInstance].remindButtonLabel = @"不喜欢,去吐槽";
    [iRate sharedInstance].cancelButtonLabel = @"以后再说";
}

- (void)checkAndRateWithController:(UIViewController *)VC
{
    self.VC = VC;
    if ([[iRate sharedInstance] shouldPromptForRating]) {
        [[iRate sharedInstance] promptForRating];
    }
}

#pragma mark irateDelegate

-(void)iRateUserDidRequestReminderToRateApp
{
    LXRMineFeedBackViewController *feedBackVC = [[LXRMineFeedBackViewController alloc] init];
    [self.VC presentViewController:feedBackVC animated:YES completion:nil];
}

-(void)iRateUserDidDeclineToRateApp
{
    [iRate sharedInstance].lastReminded = [NSDate date];
}

@end
  • 效果介绍:弹框时间及条件跟原生irate相似。点击“喜欢,支持一下”,去到appstore,点击“不喜欢,去吐槽”,去到应用内反馈界面,点击“以后再说”,三天后再次弹出。

你可能感兴趣的:(拿走即用之应用评价提醒irate)