I would like to determine which app version the user first downloaded. For that, I'm using StoreKit and the originalAppVersion
property of AppTransaction
:
let verificationResult = try await AppTransaction.shared
switch verificationResult {
case .verified(let appTransaction):
return "\(appTransaction.originalAppVersion) (\(appTransaction.environment.rawValue))"
case .unverified(let appTransaction, let verificationError):
// The app transaction didn't pass StoreKit's verification.
The code runs fine, but always returns "1.0" for the app version and "Sandbox" for the environment. I tried debug/release builds and even pushed a build to TestFlight.
Is the only way to test this to push a new App Store version that should go live?