Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    When hard work pays off

    October 14, 2025

    “Bunker Mentality” in AI: Are We There Yet?

    October 14, 2025

    Israel Hamas deal: The hostage, ceasefire, and peace agreement could have a grim lesson for future wars.

    October 14, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»ios – Can’t see ratings prompt
    iOS Development

    ios – Can’t see ratings prompt

    big tee tech hubBy big tee tech hubSeptember 4, 2025012 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – Can’t see ratings prompt
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I have the following code to show a ratings prompt when the user comes back to the app a second time and hasn’t seen the prompt. It asks the user to rate my app in the app store. I’m on the latest version of iOS.

    When I call RatingPrompt.trackVisitAndShowPromptIfNeeded(), even though the conditions are met (the user hasn’t seen the prompt and it’s been more than 1 day since they first visited the app), the prompt doesn’t show.

    What am I doing wrong?

    import StoreKit
    import UIKit
    
    struct RatingPrompt {
        private static let firstVisitKey = "firstVisitDate"
        private static let hasShownPromptKey = "hasShownRatingPrompt"
        private static let hasShownAfterFirstSummaryKey = "hasShownAfterFirstSummary"
        
        /// Call when user opens the app / visits a main screen
        static func trackVisitAndShowPromptIfNeeded() {
            let defaults = UserDefaults.standard
            let now = Date()
            
            // Save first visit date
            if defaults.object(forKey: firstVisitKey) == nil {
                defaults.set(now, forKey: firstVisitKey)
                return
            }
            
            // If already shown via visit or summary, do nothing
            if defaults.bool(forKey: hasShownPromptKey) {
                return
            }
            
            // Check if at least 1 day passed
            if let firstVisit = defaults.object(forKey: firstVisitKey) as? Date {
                let oneDay: TimeInterval = 60 * 60 * 24
                if now.timeIntervalSince(firstVisit) >= oneDay {
                    requestReview()
                    defaults.set(true, forKey: hasShownPromptKey)
                }
            }
        }
        
        /// Call when user reads their first book summary
        static func trackFirstSummaryRead() {
            let defaults = UserDefaults.standard
            
            // If already shown, do nothing
            if defaults.bool(forKey: hasShownPromptKey) || defaults.bool(forKey: hasShownAfterFirstSummaryKey) {
                return
            }
            
            // Show immediately on first summary read
            requestReview()
            defaults.set(true, forKey: hasShownAfterFirstSummaryKey)
            defaults.set(true, forKey: hasShownPromptKey) // ensure it won't show again
        }
        
        /// Internal helper to request review
        private static func requestReview() {
            if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
                let window = windowScene.windows.first {
                SKStoreReviewController.requestReview(in: window.windowScene!)
            }
        }
    }
    



    Source link

    iOS prompt ratings
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – Differences in builds between Xcode 16.4 and Xcode 26

    October 13, 2025

    ios – Apple mapkit route function dose not works in China

    October 12, 2025

    swift – Does UIDevice.current.identifierForVendor change after iCloud backup and restore on another iOS device?

    October 11, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    When hard work pays off

    October 14, 2025

    “Bunker Mentality” in AI: Are We There Yet?

    October 14, 2025

    Israel Hamas deal: The hostage, ceasefire, and peace agreement could have a grim lesson for future wars.

    October 14, 2025

    Astaroth: Banking Trojan Abusing GitHub for Resilience

    October 13, 2025
    Advertisement
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    When hard work pays off

    October 14, 2025

    “Bunker Mentality” in AI: Are We There Yet?

    October 14, 2025

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2025 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.