如何测试可更新订阅(App Store) [英] How to test renewable subscriptions (App Store)
问题描述
我正在我的应用程序中实现自动更新订阅,我想知道是否有一种方法可以模拟订阅期何时用完并创建新事务.
I'm implementing auto renewable subscriptions in my app and I wonder if there is a way to simulate when a subscription period runs out and a new transaction is created.
该应用程序连接到在线服务,该服务始终跟踪用户以及他们是否具有高级访问权限".据了解,有两种方法可以检测何时进行交易.
The app is connected to a online service that always keeps track of the users and if they have "premium access" or not. As understand i, there are two ways to detect when a transaction is made.
应用程序启动并更新Transactions:在我的 PaymentObserver 中作为 SKPaymentTransactionStateRestored 调用.然后,我从应用程序将此信息发送到更新订阅的服务器.
The app is launched and updatedTransactions: is called in my PaymentObserver as a SKPaymentTransactionStateRestored. I then, from the app, send this information to the server which updates the subscription.
我定期检查 App Store API,并将最新收据"与我的数据库中的进行比较.如果有一个新的,交易已经完成,我延长订阅.
I regularly check the App Store API and compare the "latest receipt" with the one in my database. If there is a new one, a transaction has been made and I extend the subscription.
无论哪种方式,我都需要模拟订阅期用完,App Store 进行新的交易.我该怎么做?
Either way, I need to simulate that the subscription period runs out and a new transaction is made by the App Store. How do I do this?
推荐答案
您确定需要模拟这个吗?我想你会发现在沙盒中,订阅时间很短,所以你所要做的就是喝杯咖啡什么的,它们会过期,然后你可以测试会发生什么.
Are you sure you need to simulate this? I think you'll find that in the sandbox, the subscription lengths are made very short so that all you have to do is get a cup of coffee or something and they will expire and then you can test what happens.
时间长短取决于订阅的长度,但我认为 7 天订阅在沙箱中仅几分钟后到期.
the amount of time varies depending on the length of the subscription, but I think the 7 day subscription expires in just a few minutes in the sandbox.
这篇关于如何测试可更新订阅(App Store)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!