Clicky

iOS Dev Nugget 97 Checking Which Version Of the App The User Purchased

.

Need to run a code review on your codebase? Hire me

Sometimes, it's useful to be able to check which version of the app the user purchased. E.g. you might want to know if the user has purchased v1.3 and earlier of your app because you are adding a new feature but want to make it available as an IAP for new users but free for users who have bought the app earlier. You can do this with the Receipt Validation APIs introduced in iOS 7 by pulling the Original Application Version from the receipt. The process can be a little daunting, but libraries such as RMStore wrapped it up nicely.

With RMStore, you can do:

[[RMStore defaultStore] refreshReceiptOnSuccess:^{
    RMAppReceipt* receipt = [RMAppReceipt bundleReceipt];
    NSLog(@"originalAppVersion: %@", receipt.originalAppVersion);
} failure:^(NSError *error) {
    //Something went wrong
}]


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues