How to get the original_application_version (the first purchased version number) out of iOS Receipt in iOS 11?

后端 未结 1 798
一生所求
一生所求 2021-01-17 18:23

I have a paid iOS App.

I need to get the original_application_version number (the first version purchased by the user) from the Apple AppStore Receipt.<

相关标签:
1条回答
  • 2021-01-17 18:50

    All receipt fields are in binary format within application receipt. You should use any kind of app receipt decoder in order to get original_application_version. It is always good thing to validate app receipt before using its contents. For example, you can use RMStore framework (RMStore). It contains receipt validator as well as decoder. Example Obj-C source:

    RMAppReceipt *appReceipt = RMAppReceipt.bundleReceipt;
    
    if (appReceipt != nil && 
        [appReceipt.originalAppVersion length] > 0 && 
        ![appReceipt.originalAppVersion isEqualToString:@"1.0"]) {
        //Process your original app version 
    } else {
        //Probably it is sandbox mode or app install via Xcode
        //Or maybe you should force app receipt refresh
    }
    
    0 讨论(0)
提交回复
热议问题