iOS 在 TestFlight 中恢复购买

iOS Restore Purchases in TestFlight

我有一个移动应用程序,iOS 我正在使用 TestFlight 进行测试。

在我成功 "Non-Renewing Subscription" 购买后,我希望在调用 Restore Purchases 时看到购买历史记录。当我通过 TestFlight 应用进行购买时,我没有看到任何历史购买记录。

问题

这是正常现象吗,因为这是一个测试环境,购买并不真正存在?或者,我应该期待看到历史购买吗?

如果看不到历史购买,如何测试Restore Purchases

代码:

  this.iap.restorePurchases().then((purchases: any[]) => {
      // purchases are empty
  });

获取产品成功 return 产品。

  this.iap.getProducts(this.PRODUCT_IDS).then((products: any[]) => {
     ...
  });

ps。当我 运行 Android restorePurchases 中的相同代码执行 return 历史购买时。

如果您参考 table 1-2 和 In App Purchase Programming Guide 中的随附文本,您会看到系统不会恢复不可续订的订阅;您的应用程序有责任在您自己的服务器上跟踪用户的订阅状态。

  • Non-renewable subscriptions. Subscriptions that don’t involve delivering episodic content. Examples include access to a database of historic photos or a collection of flight maps. It’s your app’s responsibility to make the subscription available on all of the user’s devices and to let users restore the purchase. This product type is often used when your users already have an account on your server that you can use to identify them when restoring content. Expiration and the duration of the subscription are also left to your app (or your server) to implement and enforce.

因此,您不会在恢复的购买中看到非续订订阅,因此您在测试和生产中看到的都是预期的。

自动续订订阅是可以恢复的,因为 Apple 的服务器正在为您跟踪有效订阅。