Display Frequency Control SKStoreReviewController

I added the following to my AppDelegate and imported StoreKit. A review modification pops up at startup, as expected. My question is, am I responsible for the frequency that this caused or is it Apple? the docs are still pretty bright, but I read elsewhere that Apple will limit this 3 times a year to the user, can I trust them to add the appropriate amount of time between them when it is displayed (ideally a couple of months)?

In my development, every time I launch the application, I would not want my users to fire it 3 times for so many starts, after which it was not asked for another 12 months.

Now that 10.3 is left, I am interested in how others have handled this.

Greetings.

    if #available(iOS 10.3, *) {
        print("Show Review Controller")
        SKStoreReviewController.requestReview()
    } else {
        print("Cannot Show Review Controller")
        // Fallback on earlier versions
    }
+6
source share
2 answers

I added the account stored in UserDefaults. It increases every time a certain action occurs, and when count % 10 == 0I call SKStoreReviewController.requestReview()(the average user is likely to increment the counter once per use of the application)

This may or may not display a view request, but it ensures that it will not be displayed too often.

As an alternative, consider persistence lastReivewAttemptDateand the minimum interval between requests.

+8
source

, , .

NSUserDefaults . , obj-c:

// Rate app action for iOS 10.3+
-(void)displayDialog {
    [SKStoreReviewController requestReview];
    [self storeTimestamp:PromptTimestampsKey];
}

- (void)storeTimestamp:(NSString *)key {
    NSNumber *todayTimestamp = [NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]];

    NSMutableArray *timestamps = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults]  arrayForKey:key]];

    // Remove timestamps more than a year old
    for (NSNumber *timestamp in timestamps) {
        if ((todayTimestamp.doubleValue - timestamp.doubleValue) > SecondsInYear) {
            [timestamps removeObject:timestamp];
        }
    }

    // Store timestamp for this call
    [timestamps addObject:todayTimestamp];
    [[NSUserDefaults standardUserDefaults] setObject:timestamps forKey:key];
}
+2

Source: https://habr.com/ru/post/1016106/


All Articles