对于iOS Storekit 2,如何反映SwiftUI观点中的订阅降级?

发布于 2025-01-21 15:13:50 字数 315 浏览 0 评论 0原文

我的应用程序有一个订阅组,有2个订阅级别:每月和每年。如果用户购买“年度”水平,然后降级为“每月”,则弹出的iOS对话框说,新降级的级别将在当前高级完成后开始。没关系;这种行为是苹果在WWDC视频中描述的。

但是,我如何反映这种新情况?我现在有一个积极的年度订阅,并且每月的观点是“计划”的,一旦年度订阅均可续签。我知道如何证明年度订阅仍然活跃,但我想向用户表明,每月订阅将在以后开始。在我看来,我该如何查询这种情况以反映它?由于尚未购买每月订阅,因此没有新的交易。我不希望用户继续按下“每月”的“购买”按钮以降级,并且除了iOS对话框外没有其他反馈。

我没有使用自己的服务器来管理订阅。

My app has a subscription group with 2 levels of subscription: monthly and yearly. If the user purchases the "yearly" level, then downgrades to "monthly", the iOS dialog that pops up says that the new downgraded level will start after the current higher level finishes. That's fine; that behavior is what Apple describes in the WWDC videos.

But how do I reflect this new situation in my View? I now have an active annual subscription and there's a monthly view that is "scheduled" to start once the annual subscription is up for renewal. I know how to show that the annual subscription is still active but I want to show the user that there's a monthly subscription that will start later. How do I query for this case to reflect it in my view? There are no new transactions since the monthly subscription hasn't yet been purchased. I don't want the user to keep pressing a "buy" button for "monthly" to downgrade and not get any feedback other than the iOS dialog.

I am not using a server of my own to manage subscriptions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不回头走下去 2025-01-28 15:13:51

我认为这可能是一种从服务器到服务器通知的状态的方法。

V1通知: did_change_renewal_pref 降级; did_change_renewal_status,Interactive_renewal 用于升级。

v2通知: did_change_renewal_pref带子类型升级和降级

I think it may be a way to fetch the status from server to server notification.

V1 Notification: DID_CHANGE_RENEWAL_PREF for downgrade; DID_CHANGE_RENEWAL_STATUS, INTERACTIVE_RENEWAL for upgrade.

V2 Notification: DID_CHANGE_RENEWAL_PREF with subtype upgrade and downgrade

摘星┃星的人 2025-01-28 15:13:50

我开发的来处理订阅的机制是可以处理升级和降级的方法。我使用两个独立的任务,每个任务都有一个侦听器函数。

第一个独立的任务聆听交易。它的关键行是:

for await result in Transaction.updates {

它根据需要更新我的本地订阅状态列表。

第二个独立任务聆听订阅更改,例如:

for await _ in Product.SubscriptionInfo.Status.updates {

还更新订阅状态的本地列表。

The mechanism I developed to handle subscriptions turns out to deal with upgrades and downgrades just fine. I use two detached Tasks that each have a listener function.

The first detached task listens for transactions. Its key line is:

for await result in Transaction.updates {

It updates my local list of subscription statuses as needed.

The second detached task listens for subscription changes like:

for await _ in Product.SubscriptionInfo.Status.updates {

and also updates the local list of subscription statuses.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文