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
}
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.
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];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With