StoreKit 2 - AppTransaction.originalAppVersion confusion

I've watched some of the WWDC session videos about this topic and read the documentation and header files, but it is still confusing...

Because I change the pricing model of my iOS App (it was a paid App and now it will be a free App with an In-App purchase), I want to check if a user of my App purchased the App in the past. So user who have already paid in the past will get the full access without the need to pay the IAP, while new users would have to do this.

In one of the WWDC videos exactly this topic was covered and the solution would be to check out AppTransaction.originalAppVersion. This would be a simple and easy solution...

...Unless I read the information from the header file and documentation for this API. Here it says:

The string value contains the original value of the CFBundleShortVersionString for apps running in macOS, and the original value of the CFBundleVersion for apps running on all other platforms.

The problem here is that when I check the Info.plist of iOS Apps, the CFBundleShortVersionString is used for the main App version and CFBundleVersion is used for the "build" number. According to the cited documentation from above, AppTransaction.originalAppVersion would be totally uselesss on the iOS platform, because it would only return the build number and not the version number.

So I'm confused. Can I use AppTransaction.originalAppVersion to get the original version that was purchased for iOS Apps? If yes, the documentation must be wrong and misleading. If no, how can I do this?

I'm currently in testing and I only get "1.0" as originalAppVersion within the beta release. This could be either because I really only get the useless build number, or I get the "real" version because the App is on the device since version "1.0" on my device, or it is just a limitation of XCode while testing that it is returning version "1.0" but would return the correct version when the App was installed from the AppStore....

Can someone bring some light into this topic? Am I missing something or did I understand something wrong?

Replies

in testing and I only get "1.0" as originalAppVersion within the beta release

Development versions always report 1.0.

In production it does report whatever is in CFBundleVersion. For my apps, in the past that was set manually to 1.2.345667. Now I think it automatically gets set to just the 34567 part.

All you really need to know is whether the version is “new” or not. So if your first free version is 2.0 build 1234567, then check for anything that contains “2.0” or “1234567”, and consider everything else “old”.

  • The question is, does originalAppVersion return the version or the build number? If it's the latter (which would be the case if the documentation is correct), then this is a problem. A new Xcode feature automatically manages the build number when uploading new builds. Xcode always starts with 1 as build number for each new version and counts upwards with new builds. So you have V1.0 B1, V1.0 B2, V1.1 B1, V2.0 B1 etc. Which means the build number is not unique and therefore is useless.

  • Did you find an answer to this?

  • I think it is best to avoid using originalAppversion and instead use originalPurchaseDate.