You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS应用中SKStoreReviewController首次启动即显示的控制方法问询

How to Control SKStoreReviewController Prompt Timing in iOS

Absolutely! Even though Apple manages the actual display frequency of the review prompt, you’re fully in charge of when you trigger the request to show it. The fix is straightforward: add your own custom guard conditions before calling SKStoreReviewController.requestReview() to avoid firing it on the user’s first launch.

Here are the most common and effective strategies to implement:

1. Trigger based on app launch count

Wait until the user has opened your app a certain number of times before asking for a review. This ensures they’ve had enough time to explore your app’s core features.

Example code using UserDefaults to track launches:

import StoreKit

func handleAppLaunch() {
    let defaults = UserDefaults.standard
    var launchCount = defaults.integer(forKey: "AppLaunchCount")
    
    // Increment the count every time the app launches
    launchCount += 1
    defaults.set(launchCount, forKey: "AppLaunchCount")
    
    // Request review only after the 5th launch (adjust this number to fit your app)
    if launchCount == 5 {
        guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return }
        SKStoreReviewController.requestReview(in: scene)
    }
}

Call this function when your app finishes launching (e.g., in sceneDidBecomeActive or applicationDidFinishLaunching).

2. Trigger based on usage duration

Wait until the user has spent a meaningful amount of time using your app. This could be cumulative time across sessions or a single long, engaged session.

Example tracking cumulative usage time:

import StoreKit

var sessionStartTime: Date?

func sceneDidBecomeActive(_ scene: UIScene) {
    sessionStartTime = Date()
}

func sceneWillResignActive(_ scene: UIScene) {
    guard let startTime = sessionStartTime else { return }
    let sessionDuration = Date().timeIntervalSince(startTime)
    
    let defaults = UserDefaults.standard
    var totalUsageTime = defaults.double(forKey: "TotalAppUsageTime")
    totalUsageTime += sessionDuration
    defaults.set(totalUsageTime, forKey: "TotalAppUsageTime")
    
    // Request review after 10 minutes of total usage (600 seconds)
    if totalUsageTime >= 600 {
        SKStoreReviewController.requestReview(in: scene)
        // Reset the count so we don't request again immediately
        defaults.set(0, forKey: "TotalAppUsageTime")
    }
}

3. Trigger after key user actions

Ask for a review only after the user has completed a core feature of your app (e.g., finishing a task, making a purchase, or creating content). This ensures they’ve had a positive, engaging experience with your app before being asked to rate it.

Example after completing a core action:

import StoreKit

func userCompletedCoreTask() {
    // Mark that the user has completed the core task
    UserDefaults.standard.set(true, forKey: "HasCompletedCoreTask")
    
    // Combine with launch count to avoid spamming new users
    let launchCount = UserDefaults.standard.integer(forKey: "AppLaunchCount")
    if launchCount >= 3 {
        guard let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return }
        SKStoreReviewController.requestReview(in: scene)
    }
}

Important Notes:

  • Don’t override Apple’s rules: Even if you trigger the request, Apple will still limit how often the prompt appears (max 3 times per 12 months per user). Your conditions just ensure you don’t waste a prompt on a brand-new user.
  • Avoid custom pre-prompts: Don’t show your own "Would you like to rate us?" alert before calling SKStoreReviewController. Apple discourages this practice and it could lead to app rejection.
  • Testing tips: In development, calling requestReview() will show the prompt every time. In TestFlight or production, Apple’s frequency limits apply, so you may not see it on every trigger.

内容的提问来源于stack exchange,提问作者Oren Shpungin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:08:57