First off, this question pertains to iOS7+ receipts so all the questions/answers on SO which refer to latest_receipt
and latest_receipt_info
are not applicable (as they have been deprecated and are going away). It seems that the bulk of the knowledge base about renewing subscriptions on SO is from 2011 and 2012 so is misleading and providing incorrect information for current specs.
I know when my user's current subscription expires. I want to know if they renewed it or not. According to Apple when their subscription is renewed:
After a subscription is successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same way as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer is not called; your app finds out about the renewal the next time it’s launched.
That all makes sense. So now the obvious question, which Apple does not address, is how do I determine if the subscription was renewed if the user does not close the app and relaunch it (which causes StoreKit to send the app the transaction to process)? If the user leaves the app open for a long period of time the transaction will not be received but I can't continue to provide the content because the expiration date has passed. In theory a user could leave the app running for months without relaunching.
Is the answer to call [NSBundle mainBundle].appStoreReceiptURL
to get the receipt myself and then validate it? Will this provide the updated receipt? And then when the transaction arrives from the StoreKit queue on next launch just process that same receipt a second time (since there is no real way to ignore it)? This seems very kludgy. If we have to get the receipt ourselves in some cases, why bother sending it to us via the queue at all?
Any thoughts on the correct workflow?