Trouble getting the original app version that the user installed (receipt validation)?

后端 未结 2 649
误落风尘
误落风尘 2021-02-03 13:05

I have an app that I recently updated to work with in app purchases. The previous version (paid but with no in app purchases) was 1.0 and the current version is 1.1.

As

2条回答
  •  伪装坚强ぢ
    2021-02-03 13:30

    I stumbled upon the same issue - I converted my app from paid to freemium and tried to use original_application_version in the app receipt to decide who to unlock the new freemium features for. I, too, was unsuccessful.

    However, what I found out was that I was using original_application_version incorrectly. The name misled me into thinking that this string corresponds to the version number of the app. On iOS, it does not. original_application_version is actually the build number of the app.

    Original Application Version

    This corresponds to the value of CFBundleVersion (in iOS) or CFBundleShortVersionString (in macOS) in the Info.plist file when the purchase was originally made. In the sandbox environment, the value of this field is always “1.0”.

    Source: https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html

    I think this could be the reason why you are getting a number you are not expecting.

    Using original_purchase_date, as you did in the end, is a reliable alternative though.

提交回复
热议问题