iOS Restore Purchases in TestFlight

自闭症网瘾萝莉.ら 提交于 2019-12-11 05:35:06

问题


I have a mobile app, which for iOS I am testing with TestFlight.

After I make a successful "Non-Renewing Subscription" purchase, I would expect to see the purchase history when I call Restore Purchases. When I make a purchase through the TestFlight app, I do not see any historic purchases.

Question

Is this normal behaviour because this is a test environment, and the purchases don't really exist? Or, should I expect to see the historic purchases?

If one cannot see the historic purchases, how do you test Restore Purchases?

Code:

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

The get Products does return the products successfully.

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

ps. When I run this same code in Android restorePurchases does return the historic purchases.


回答1:


If you refer to table 1-2 and the accompanying text in the In App Purchase Programming Guide you will see that non-renewable subscriptions are not restored by the system; it is your app's responsibility to track the user's subscription status on your own server.

  • 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.

Accordingly you will not see a non-renewing subscription in the restored purchases, so what you are seeing is expected both in test and production.

Auto renewing subscriptions are restorable since Apple's server is tracking the active subscription for you.



来源:https://stackoverflow.com/questions/45079214/ios-restore-purchases-in-testflight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!