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)
In the Xcode console, when retrieving the current version, it prints the build number.
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.
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.")
}
}