Controlling SKStoreReviewController Display Frequency
Asked Answered
G

2

7

I've added the following to my AppDelegate and imported StoreKit. The review modal pops up on launch as expected. My question is, am I the person in charge of the frequency that this gets called or is Apple? The docs are still pretty light but I read elsewhere that Apple will be limiting this to 3 times a year per user, can I trust them to add the appropriate amount of time in between when it is displayed (ideally a couple of months)?

In development its popping up every time I launch the app, I would hate for my users to have to dismiss it 3 times in as many launches then not get asked again for 12 months.

Now that 10.3 is out I'm interested in how others have tackled this.

Cheers.

    if #available(iOS 10.3, *) {
        print("Show Review Controller")
        SKStoreReviewController.requestReview()
    } else {
        print("Cannot Show Review Controller")
        // Fallback on earlier versions
    }
Groenendael answered 28/3, 2017 at 11:28 Comment(1)
I've just learned the hard way that Apple didn't space out the 3 times a year evenly over the year. My implementation was, after the 3rd time of a certain action in app, call requestReview(), every time. Doh. Turned out the review request pops up EVERY time after the three actions. Three times. Then no more, for a year, supposedly. As stated in answers here, storing the last request attempt date in user defaults etc should be a sane way of handling this.Anathema
A
10

I've added a count that's stored in UserDefaults. It's incremented every time a certain action occurs, and when count % 10 == 0 I call SKStoreReviewController.requestReview() (the average user will likely increment the count once per use of the app)

This may or may not display the review request, but it ensures it's not displayed too often.

Alternatively, consider storing a lastReivewAttemptDate and a minimum interval between requests.

Alabaster answered 28/3, 2017 at 11:59 Comment(3)
I have ended up doing something similar, I have a value stored in user defaults with an initial value of 5. Whenever the user successfully adds a particular object I remove 1 from that user defaults number, once it reaches zero I call SKStoreReviewController.requestReview() and reset the value to 5.Groenendael
@FaizFareed Please ask this as another question.Alabaster
@AshleyMills , Thanks for your instruction, but I think I'll do it by myself. so no needs to generate another question. & sorry for my above comment. so going to remove that.Mallon
E
2

You're not in charge of counting this - but doing so allows you to be more strategic when you are potentially running out of calls.

Saving timestamps for each call inside NSUserDefaults seems to be the most flexible way of keeping track. This is what I do in 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];
}
Endogamy answered 16/6, 2017 at 21:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.