I\'m implementing in-app purchases for my app (to be released), and providing support for iOS6 and iOS7. My question has to do with differences between non-renewing subscrip
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];