21.7 C
Canberra
Tuesday, October 21, 2025

ios – Cannot see rankings immediate


I’ve the next code to indicate a rankings immediate when the consumer comes again to the app a second time and hasn’t seen the immediate. It asks the consumer to price my app within the app retailer. I am on the newest model of iOS.

After I name RatingPrompt.trackVisitAndShowPromptIfNeeded(), despite the fact that the situations are met (the consumer hasn’t seen the immediate and it has been greater than 1 day since they first visited the app), the immediate does not present.

What am I doing improper?

import StoreKit
import UIKit

struct RatingPrompt {
    personal static let firstVisitKey = "firstVisitDate"
    personal static let hasShownPromptKey = "hasShownRatingPrompt"
    personal static let hasShownAfterFirstSummaryKey = "hasShownAfterFirstSummary"
    
    /// Name when consumer opens the app / visits a most important display screen
    static func trackVisitAndShowPromptIfNeeded() {
        let defaults = UserDefaults.normal
        let now = Date()
        
        // Save first go to date
        if defaults.object(forKey: firstVisitKey) == nil {
            defaults.set(now, forKey: firstVisitKey)
            return
        }
        
        // If already proven through go to or abstract, do nothing
        if defaults.bool(forKey: hasShownPromptKey) {
            return
        }
        
        // Verify if a minimum of 1 day handed
        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)
            }
        }
    }
    
    /// Name when consumer reads their first ebook abstract
    static func trackFirstSummaryRead() {
        let defaults = UserDefaults.normal
        
        // If already proven, do nothing
        if defaults.bool(forKey: hasShownPromptKey) || defaults.bool(forKey: hasShownAfterFirstSummaryKey) {
            return
        }
        
        // Present instantly on first abstract learn
        requestReview()
        defaults.set(true, forKey: hasShownAfterFirstSummaryKey)
        defaults.set(true, forKey: hasShownPromptKey) // guarantee it will not present once more
    }
    
    /// Inner helper to request evaluation
    personal static func requestReview() {
        if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
            let window = windowScene.home windows.first {
            SKStoreReviewController.requestReview(in: window.windowScene!)
        }
    }
}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles