Using appStoreReceiptURL to restore non-renewing subscription

谁说我不能喝 提交于 2019-12-10 10:57:12

问题


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


回答1:


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];


来源:https://stackoverflow.com/questions/24718479/using-appstorereceipturl-to-restore-non-renewing-subscription

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