控制 SKStoreReviewController 显示频率

Controlling SKStoreReviewController Display Frequency

我已将以下内容添加到我的 AppDelegate 并导入了 StoreKit。审查模式按预期在启动时弹出。我的问题是,我是负责此调用频率的人还是 Apple? docs are still pretty light but I read elsewhere Apple 将限制每个用户每年 3 次,我可以相信他们会在显示之间添加适当的时间(最好是几个月)吗?

在开发过程中,每次我启动该应用程序时它都会弹出,我不希望我的用户不得不在多次启动中关闭它 3 次,然后在 12 个月内不再被询问。

现在 10.3 已经出来了,我很想知道其他人是如何解决这个问题的。

干杯。

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

我添加了一个存储在 UserDefaults 中的计数。每次发生特定操作时它都会增加,当 count % 10 == 0 我调用 SKStoreReviewController.requestReview() 时(普通用户可能会在每次使用该应用程序时增加一次计数)

这可能会或可能不会显示审核请求,但它确保它不会显示得太频繁。

或者,考虑存储 lastReivewAttemptDate 和请求之间的最小间隔。

您不负责计算这一点 - 但这样做可以让您在可能 运行 没电时更具战略性。

在 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];
}