LFSAskForReview 是一个类,您可以将其添加到 iOS 应用以让用户评分。其主要功能包括:不要求用户在每个版本中多次评分;完全可定制,您可以
@property (strong, nonatomic) id<LFSAskForReviewServiceDataSource>dataSource;
@property (strong, nonatomic) id<LFSAskForReviewServiceDelegate>delegate;
//Singleton
+ (LFSAskForReviewService *)sharedService;
//Method to call when the user action that could trigger the ask for review alert happened.
- (void)askIfNecessaryAfterUserAction:(NSString *)action;
/**
For a given action, returns the number of repetitions that must happen before showing the alert asking for a review.
*/
- (NSUInteger)necessaryRepetitionsForAction:(NSString *)action
{
if ([action isEqualToString:@"OpenSection"]) {
return 10;
}
if ([action isEqualToString:@"SendMessage"]) {
return 20;
}
return 0;
}
/**
Returns the title to be displayed in the alert.
*/
- (NSString *)title
{
return @"Y U NO RATE";
}
/**
Returns the message to be displayed in the alert.
*/
- (NSString *)message
{
return @"We have a family to feed\n PLEASE RATE US";
}
/**
Returns the title for the positive answer button of the alert.
*/
- (NSString *)positiveButtonTitle
{
return @"YOU'RE AWESOME";
}
/**
Returns the title for the negative answer button of the alert.
*/
- (NSString *)negativeButtonTitle
{
return @"YOU'RE A DICK";
}
/**
Handles user's positive response to the ask for review alert.
*/
- (void)userResponseWasNegative
{
//Do whatever you want
}
/**
Handles user's negative response to the ask for review alert.
*/
- (void)userResponseWasPositive
{
//Do whatever you want
}