Skip to main content

I want to present the Paywall, if needed, on every 4th launch of the app. I can track the launch count, but can’t seem to figure out how to couple this with .presentPaywallIfNeeded in the ContentView.
 

// Show paywall every 4th launch
if launchCount % 4 == 0 {
// Present RevenueCat Paywall
presentPaywall()
}
import Foundation
import RevenueCat

class SubscriptionManager: ObservableObject {
@Published var hasPro: Bool = false

init() {
checkSubscriptionStatus()
}

func checkSubscriptionStatus() {
Purchases.shared.getCustomerInfo { (customerInfo, error) in
if let error = error {
print("Error fetching customer info: \(error.localizedDescription)")
return
}

print("checkSubscriptionStatus")

DispatchQueue.main.async {
self.hasPro = customerInfo?.entitlementsn"pro"]?.isActive == true
print("hasPro: \(self.hasPro))")
}
}
}
}

 

Hi! Happy to take a look at this! Can you share the code snippet from your presentPaywall method so I can take a look at how you are calling our methods?


Thanks for reaching out @wes_clark. I'm good to go, I was able to get past this. Much appreciate the offer to help!