iOS In-App purchasing and subscriptions : Testing

独自空忆成欢 提交于 2019-12-03 10:17:34

问题


A college of mine has implemented iOS in-app purchasing on a auto-renewing monthly basis. I am taking over the code base and want to test it is working. I know the purchasing is wokring but the auto-renewing is what I am worried about.

I have set up a test user and read the Apple documentation that says in sandbox mode, a month is 5 minutes in the sandbox.

However I am not getting any post back from Apple after 5 minutes? should I?

In the AppDelegate I have

 inAppPurchase = [TFInAppPurchase new];
[[SKPaymentQueue defaultQueue] addTransactionObserver:inAppPurchase];
[inAppPurchase updateAvailableProductsCache];

I am expecting after 5 minutes, it to fire of a notification or something?


回答1:


There is no notification. You keep track of it yourself (the duration). You get a receipt with the original transaction that you save. Use this to verify (perhaps on launch each time) that the user's subscription is still active.




回答2:


In the iTunes development guide, there's list of how long auto-renew subscriptions last in sandbox mode:

Sandbox Testing Your In-App Purchases

You are required to test your in-app purchases in a sandbox environment before you submit them for review by Apple. You must first sign out of your iTunes Store account from your test device Settings before attempting to use the sandbox environment. If you mistakenly use your test-user-account credentials to log in to a production environment on your test device (instead of in to your test environment), your account credentials become invalid and cannot be used as a test account again. For more details on how to avoid mistakes during test account use, see “Using Test User Accounts.”

When testing auto-renewable in-app purchase subscriptions in the sandbox environment, the duration times will be compressed to allow for more streamlined testing. Additionally, a sandbox subscription will only auto-renew a maximum of 6 times. After the subscription has auto-renewed 6 times, it will no longer renew in the sandbox. The compressed duration times are as follows:

   Actual duration      Sandbox duration
   1 week               3 minutes 
   1 month              5 minutes
   2 months             10 minutes 
   3 months             15 minutes 
   6 months             30 minutes 
   1 year               1 hour



回答3:


No notification will be generated by apple. You have to save the recipes on server or device by using nsuserdefaults or keychain. you have to track the duration by yourself.By caluclating Compare the product identifier in question to the product identifier of each in-app purchase receipt. If there is a receipt that matches, validation succeeds. Otherwise, validation fails.

When validation succeeds, your application enables the purchased functionality—for example, by downloading content or adding features. When validation fails, your application simply does not enable the functionality.



来源:https://stackoverflow.com/questions/14710240/ios-in-app-purchasing-and-subscriptions-testing

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