iphone - MKStoreKit 是在应用程序订阅中用于自动更新的正确选项吗?

标签 iphone ios mkstorekit

你好 friend 我只想知道几个问题:

  1. MKStoreKit 非常适合用于自动续订订阅,或者它是否有任何漏洞,因为我使用它使用内置模型在有限的时间段内订阅多个产品。?

  2. 我正在使用 MKStoreKit 处理自动续订订阅。我目前正在测试 1 个月的订阅(在测试中订阅持续 5 分钟)。购买订阅后,我等待它过期。一旦到期,我会检查订阅是否仍然有效。 这会像我期望的那样返回 false。但是,由于它是自动续订的,我希望 MKStoreKit 届时联系 Apple 以重新验证订阅。

  3. 我有责任在订阅到期时处理自动续订吗,我的意思是说我必须在我的应用程序中实现 kSubscriptionsPurchasedNotification 通知的观察者。

提前致谢

最佳答案

我也有过这个问题。

  1. MKStoreKit 现在不是一个理想的解决方案,因为它不支持 iOS7 和新的 App Receipt 系统。

2-3。苹果documentation解释说他们会在到期前的 24 小时内更新收据,然后:

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

您的应用“在启动时检查交易队列”,您需要通过

设置SKPaymentTransactionObserver
[[SKPaymentQueue defaultQueue] addTransactionObserver:yourTransactionObserver];

处理:

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions

就像您第一次订阅时一样。

在测试时,您可以尝试强制关闭您的应用,然后在它过期后重新启动它,看看它是否在启动时成功更新。或者,您可以重新验证您从原始订阅中保存的收据。如果发生续订,验证服务器会返回新的收据,然后您可以从中获取最近的到期日期。

我已将我的自动更新订阅实现放在 github 上如果你想检查一下。 RMStore是另一个支持 iOS7 的库,也适用于其他类型的购买。

关于iphone - MKStoreKit 是在应用程序订阅中用于自动更新的正确选项吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16946440/

相关文章:

iphone - Objective-C 中的数组变量访问问题

ios - iOS 应用程序能否在 Xcode 模拟器中运行以访问 Mac 硬盘驱动器位置(在沙箱之外)

objective-c - 我的字符串怎么可能不安全?

ios - 如何在将其组件之一移动到其边界附近时向上/向下滚动 UICollectionView?

ios - 无法在iOS 8 Beta上购买IAP(沙盒)

iphone - 测试账号恢复MKStoreKit中未购买的商品

ios - 保留 iPhone X 主屏幕指示器的纵向位置

Android视口(viewport)设置 "user-scalable=no"打破视口(viewport)的宽度/缩放级别

iPhone:以编程方式检查应用内购买状态

iphone - 如何在应用程序的每个 View 中捕获触摸事件?