79388774

Date: 2025-01-26 15:34:14
Score: 2.5
Natty:
Report link

This seems to be exactly what’s happening, Apple does not consider the original version as the commercial version. I can imagine that it takes the build uploaded to TestFlight (not even the one shown in Xcode) enter image description here

In the Xcode console, when retrieving the current version, it prints the build number.

enter image description here

The issue with this is that for each version of the app, I have uploaded 3-4 or even 10 builds, and all of these (users who paid for the app) must be able to download it as premium. Because of this, I assume that there are users with an original version between 1 and 10, so this value is not useful for me.

enter image description here

Don't you think OriginalPurchaseDate could be a solution?

func fetchActiveTransactions() async {
    let cohortDateComponents = DateComponents(year: 2025, month: 1, day: 24, hour: 0, minute: 0, second: 0)
    let cohortDate = Calendar.current.date(from: cohortDateComponents)!

    let shared = try? await AppTransaction.shared
    print(shared as Any)
    
    if case .verified(let appTransaction) = shared {
        print("Verified \(appTransaction)")
        
        let originalPurchaseDate =  appTransaction.originalPurchaseDate
        print("Original Purchase Date: \(originalPurchaseDate)")
        
        if originalPurchaseDate < cohortDate {

            print("\(originalPurchaseDate) is before to \(cohortDate). Is premium.")
            await MainActor.run {
                print("User is premium because \(originalPurchaseDate) is before to \(cohortDate).")
                self.isPremium = true
                self.isLegacyPremium = true
                self.purchaseDate = appTransaction.originalPurchaseDate
            }
            return
        } else {
 
            print("\(originalPurchaseDate) is after \(cohortDate). You need to validate it in RevenueCat.")
            do {
                print("Checking premium status in RevenueCat...")
                let customerInfo = try await Purchases.shared.customerInfo()
                self.isPremium = customerInfo.entitlements["premium"]?.isActive == true
                print("Premium State: \(self.isPremium)")
            } catch {
                print("Error obtaining customer info from RevenueCat: \(error.localizedDescription)")
            }
        }
    } else {
        print("Cannot fetch  transactions.")
    }
}
Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: GMarkoslansvka