Non-renewing Subscriptions: Removed From Receipt?

北城以北 提交于 2019-11-28 19:41:41

Be careful, persisting non-renewing subscriptions in App Receipt gives you no guarantee to be accepted by App Store reviewers. The success depends on particular reviewer. I've got this message from Apple recently:

We found that your app includes a feature to restore previously purchased In-App Purchase products by entering the user's Apple ID and password. However, Non-Renewing Subscription In-App Purchases cannot be restored in this manner.

It would be appropriate to revise your binary to remove this feature. If you would like users to be able to restore Non-Renewing Subscription In-App Purchase products, you will need to implement your own restore mechanism.

So the last attempt to submit the app was unlucky. Unlike the previous few.

So now, my plan is to store the App Receipt on iCloud Key-Value Storage and automatically restore all the purchases. It would satisfy Apples requests:

For non-renewing subscriptions, use iCloud or your own server to keep a persistent record. (c) Store Kit Programming Guide

here is the Apple's code provided for these purposes:

#if USE_ICLOUD_STORAGE
NSUbiquitousKeyValueStore *storage = [NSUbiquitousKeyValueStore defaultStore];
#else
NSUserDefaults *storage = [NSUserDefaults standardUserDefaults];
#endif

NSData *newReceipt = transaction.transactionReceipt;
NSArray *savedReceipts = [storage arrayForKey:@"receipts"];
if (!receipts) {
    // Storing the first receipt
    [storage setObject:@[newReceipt] forKey:@"receipts"];
} else {
    // Adding another receipt
    NSArray *updatedReceipts = [savedReceipts arrayByAddingObject:newReceipt];
    [storage setObject:updatedReceipts forKey:@"receipts"];
}

[storage synchronize];

This has also been puzzling the heck outta me. After looking at the docs many times, I finally saw the following in the receipt field notes for the Receipt Validation Programming Guide:

The in-app purchase receipt for a consumable product is added to the receipt when the purchase is made. It is kept in the receipt until your app finishes that transaction. After that point, it is removed from the receipt the next time the receipt is updated—for example, when the user makes another purchase or if your app explicitly refreshes the receipt.

The in-app purchase receipt for a non-consumable product, auto-renewable subscription, non-renewing subscription, or free subscription remains in the receipt indefinitely.

Whereas the section on "Persisting Using the App Receipt" in the In-App Purchase Programming Guide still indicates that consumables and non-renewing subscriptions are treated the same.

I'm guessing from the behavior that we are observing that the IAP document is out of date? I hope so.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!