2

I can use the receipt obtained by appStoreReceiptURL to retrieve the purchase date of non-renewing subscription. For non-renewing subscription, from the purchase date I could calculate the expiration date.

But when I try to restore using appStoreReceiptURL. I found that it returns nil on devices that did not make purchase even signing in with the same Apple ID.

Using

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

cannot update the receipts in appStoreReceiptURL. Did I do anything wrong here? Or is it just not possible to restore the receipts this way?

Thanks

John
  • 2,672
  • 2
  • 23
  • 29
  • Hi, it's have been a very long time. But do you remember if you have managed to use iCloud for restoring purchases? – mr.kostua Nov 23 '22 at 12:07
  • 1
    I changed to receipt calculation method already, and it works very well now. I think Apple changed their policy after these years. If you still insist on using iCloud, it's simply save an Expiration Date on iCloud after completed purchase, just like NSUserDefault to save NSDate. But I regretted the use of iCloud, because I did that back in 2014, my app cannot be transferred to other account because of using iCloud – John Dec 02 '22 at 06:22
  • Thanks for the answer (I have used receipt calculation method) @John – mr.kostua Dec 06 '22 at 13:16

1 Answers1

2

You cannot restore the transactions in the way you are trying as they are consumables, and consumables have a finite life.

However, you could parse the receipt, and calculate the subscription period from this.

The receipt will be in the main bundle, but can be refreshed by using

recreq = [[SKReceiptRefreshRequest alloc] init];
        [recreq setDelegate:self];
        [recreq start];
NeilMortonNet
  • 1,500
  • 4
  • 16
  • 36
  • Thanks for your answer. I did setup my app to restore this way: refreshing the receipt and re-calculate the expiration date. It works great. However, my app got rejected by Apple, they want me to have an optional registration for user to restore, or use iCloud. So don't restore it this way. – John Aug 08 '14 at 17:31
  • Firstly, I am glad to hear that you figured it out. Secondly, I have already had my app approved. There is no need to use either iCloud or an optional registration. Take a look at http://www.progressconcepts.com/blog/non-renewing-subscription-app-purchases-ios/ for a blog post I wrote on it earlier. If you want to reach out to me (see blog) I am happy to discuss further, but please do be assured Apple will approve this. – NeilMortonNet Aug 08 '14 at 20:42
  • Man, you got it approved? I got this instead: It would be appropriate to modify your app to include an optional user registration feature, to deliver subscription content to all of a user's iOS devices. Such user registration must be made optional, not required. We also recommend indicating that registering is required to access the subscription content from their other iOS devices - and providing a way to register later, if users wish to have access to this content at a future time. – John Aug 08 '14 at 20:51
  • I really like the calculation from receipt way, it's neat and not as easy for users to cheat. Can you tell me more how to get approval? – John Aug 08 '14 at 20:56
  • Did you include a restore subscription button? You need to ensure you include a restore purchase which will call SKReceiptRefresh to pull down the receipt to the other devices and iterate through the receipt to get the subscription information. – NeilMortonNet Aug 08 '14 at 21:27
  • If you want to drop me a message through blog I am happy to email more info if needed. – NeilMortonNet Aug 08 '14 at 21:28
  • @John - Were you able to figure this out? My app was rejected for using receipts to calculate the expiration date too. Did you try any alternative method? – tbag Nov 16 '14 at 00:08
  • @tbag I am aware of a few apps doing this. Drop me a private message or via my blog and I'll be happy to help. – NeilMortonNet Nov 16 '14 at 00:13
  • Sent you a message on your blog. Thanks! – tbag Nov 16 '14 at 02:20
  • @tbag, no luck, gotta use iCloud to restore in order to get approved. There might be some apps successfully get through, but mine didn't. :( – John Nov 16 '14 at 07:02