gpt4 book ai didi

iOS 应用内购买和检测自动更新订阅

转载 作者:行者123 更新时间:2023-12-04 18:41:37 24 4
gpt4 key购买 nike

我有几个关于检测订阅已自动续订的过程的问题。

目前,我的沙盒测试环境已全部设置完毕,我可以购买 1 个月的订阅服务,所有这些都运行良好。

我的问题如下:

  1. 我是否需要验证应用内购买的初始收据(或任何后续收据)?如果是这样,原因是什么?

  2. 当自动续订发生时,我的应用是否会通过 paymentQueue:updatedTransactions: 调用收到通知?在沙盒环境和生产环境中。

到目前为止,我还没有看到 StoreKit 通知我续订订阅(在沙盒环境中),但我也了解到它很挑剔,可能不会。

我应该考虑的有关自动续订订阅的任何一般提示?

感谢您的帮助和时间!

最佳答案

1。关于收据验证

收据验证是您在解锁用户内容之前执行额外安全检查的方法。将收据视为乐透彩票。一位客户带着“中奖彩票”来找您。根据您认为彩票奖励的值(value),您可以将中奖的人赠予该人,或者您可以联系 Apple 并检查该用户是否真的通过他们购买了这张彩票。

客户可能通过一些恶意手段获得了这张乐透票,比如越狱设备等,因此是否要验证收据完全由您决定。

2。关于续订通知

官方documentation陈述如下:

After a subscription is successfully renewed, Store Kit adds atransaction for the renewal to the transaction queue. Your app checksthe transaction queue on launch and handles the renewal the same wayas any other transaction. Note that if your app is already runningwhen the subscription renews, the transaction observer is not called;your app finds out about the renewal the next time it’s launched.

因此,您绝对应该在您的应用中收到收据更新通知。不要忘记,您应该始终将自己添加为 StoreKit's paymentQueue 的观察者。为了让它起作用,你的应用程序委托(delegate) didFinishLaunching 中的这样的东西会起作用:

//where YourObserver is an object that is alive for the apps lifecycle
[[SKPaymentQueue defaultQueue] addTransactionObserver:YourObserver];

关于iOS 应用内购买和检测自动更新订阅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21417458/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com