3

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?

phi
  • 10,634
  • 6
  • 53
  • 88
  • Did you find an answer to this? – Deepak Sharma Jul 12 '23 at 17:17
  • Having a similar issue. Finding it hard to test as whatever I do to attempt to remove the app and directories from my test machine and Sandbox accounts, it always recognises I had the previous version. Creating a new VM it does correctly recognise the first version I deploy as a developer team version. Once it has a version installed that seems to persist. – Hongtron Aug 14 '23 at 12:30

0 Answers0