问题描述
我们的iOS应用使用一次性购买和自动续订的应用内购买.这两个都是非消耗性的.
Our iOS app uses in-app purchases, both one-time and an auto-renewing subscription. Both these are non-consumable.
iOS offers two APIs: refresh receipt, and restore completed transactions.
似乎后者适用于所有情况,而前者仅适用于某些情况.具体来说,当我们将自动续签的购买还原到新设备时,还原购买的交易将导致以后的续订产生一个交易,该交易将在后台发送到新设备,而刷新收据不会导致交易被重新执行.下次续订时发送到此设备.
It seems that the latter works for all cases, while the former works in only some cases. Specifically, when we restore an auto-renewable purchase to a new device, restore purchased transactions will cause future renewals to generate a transaction that will be sent in the background to the new device, where as refreshing the receipt will not cause a transaction to be sent to this device the next time there is a renewal.
鉴于此,是否有任何理由使用刷新收据?
Given this, is there any reason to use refresh receipt?
Apple似乎说我们可以使用:
Apple seems to say we can use either:
推荐答案
您需要阅读恢复购买的产品,以了解2之间的目的.
You need to read this Restoring Purchased Products to understand the purposes between the 2.
在iOS 7中,从商店下载的每个应用程序在appStoreReceiptURL
处都有一张收据(用于下载/购买应用程序).当用户通过In App Purchase购买商品时,appStoreReceiptURL
处的内容会用购买信息进行更新.在大多数情况下,您只需要刷新收据(位于appStoreReceiptURL
),就可以知道用户进行了哪些交易.
From iOS 7, every app downloaded from the store has a receipt (for downloading/buying the app) at appStoreReceiptURL
. When users purchases something via In App Purchase, the content at appStoreReceiptURL
is updated with purchases information. Most of the cases, you just need to refresh the receipt (at appStoreReceiptURL
) so that you know which transactions users have made.
在大多数情况下,您的应用所需要做的就是刷新收据,并在收据中交付产品.刷新后的收据包含用户在此应用程序,此设备或任何其他设备上的购买记录.但是,由于以下原因之一,某些应用需要采用其他方法:
In most cases, all your app needs to do is refresh its receipt and deliver the products in its receipt. The refreshed receipt contains a record of the user’s purchases in this app, on this device or any other device. However, some apps need to take an alternate approach for one of the following reasons:
如果您使用 Apple托管的内容,则还原已完成的交易将为您的应用提供用于下载内容的交易对象. 如果您需要支持无法使用应用收据的iOS 7之前的iOS版本,请还原已完成的交易.
If you use Apple-hosted content, restoring completed transactions gives your app the transaction objects it uses to download the content. If you need to support versions of iOS earlier than iOS 7, where the app receipt isn’t available, restore completed transactions instead.
刷新收据会向App Store索要收据的最新副本. 刷新收据不会创建任何新交易.
Refreshing the receipt asks the App Store for the latest copy of the receipt. Refreshing a receipt does not create any new transactions.
恢复已完成的交易会为用户进行的每个已完成的交易创建一个新交易,实质上是为您的交易队列观察者重播历史记录.
Restoring completed transactions creates a new transaction for every completed transaction the user made, essentially replaying history for your transaction queue observer.
有关收据的更多信息,来自WWDC 2017,StoreKit会话中的新增功能 https://developer.apple.com/videos/play/wwdc2017/303/
More about receipt, from WWDC 2017, What's new in StoreKit session https://developer.apple.com/videos/play/wwdc2017/303/
您还可以观看WWDC 2017,在Advanced StoreKit上了解更多详细信息 https://developer.apple.com/videos/play/wwdc2017/305/
You can also watch WWDC 2017, session Advanced StoreKit for more detail https://developer.apple.com/videos/play/wwdc2017/305/
这篇关于何时刷新收据与在iOS中恢复购买?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!