Skip to main content
Question

iOS: reliably get originalApplicationVersion without prompting for AppStore login

  • May 30, 2022
  • 1 reply
  • 317 views

Matthew Flint
Forum|alt.badge.img+2

Hello all,

I’d like to check the originalApplicationVersion for my iOS app, without prompting the user to login to their AppStore account.

Your “converting a paid iOS app to subscription” blogpost has the following code, which looks like it should do what I want:

if let receiptURL = Bundle.main.appStoreReceiptURL,

   let _ = try? Data(contentsOf: receiptURL) {

    Purchases.shared.restoreTransactions { (info, error) in

        completion?(info)

    }

}
 

This implies that it’s safe to call restoreTransactions if we’re certain that there is a receipt on the device.

However, the (recently renamed) restoreTransactions function has a refresh policy of .always, which I suspect might prompt the user to login.

So my questions:

  • will restoreTransactions ever prompt for AppStore login if there is a receipt on the device?
  • if that function might prompt, is there a reliable way to get originalApplicationVersion from an on-device receipt without prompting?

Thank-you!

  Matthew

 

This post has been closed for comments

1 reply

Matthew Flint
Forum|alt.badge.img+2

Ooh, new in iOS 16: AppTransaction.shared.originalAppVersion 🎖

https://developer.apple.com/documentation/storekit/apptransaction

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings