I'm unable to test Subscription renewal via StoreKit Testing in Xcode unless the subscription is a monthly subscription. I'm trying to test a weekly subscription but under the Editor menu there is no entires for anything other than Monthly? (Xcode 13.3). Setting the interval to the fastest ("Monthly Renewal Every 30 Seconds") does nothing if the active subscription is a weekly subscription. Is there no way to test subscriptions unless they are monthly?
Subscription Renewal Rate in StoreKit Testing for Xcode Not Working For Subscriptions Unless They Are Monthly Subscriptions?
Although the subscription renewal rates in Xcode 13.2 and later are in terms of a monthly renewal, you can still use these rates to modify the rate subscriptions of durations other than monthly renew at. The rates will extrapolate to be roughly proportional to how the monthly renewal changes. These rates are identical to the rates in the sandbox environment, so you can use the table on the Test in app purchases document as a reference.
There are time rate options unique to StoreKit Testing in Xcode: Real Time, and Monthly Renewal Every 30 Seconds. Here is how the latter effects durations:
- 1 week: 10 seconds
- 1 month: 30 seconds
- 2 months: 1 minute
- 3 months: 90 seconds
- 6 months: 3 minutes
- 1 year: 6 minutes
Keep in mind when using Xcode 13.2 or later with an OS earlier than iOS 15.2, macOS 12.1, watchOS 8.3 or tvOS 15.2, these rates will map to the closest time rate in Xcode 13.1 and earlier. Due to this, they won't be exactly the same times as the table describes.
Another important note is the time rate is decided at the time a transaction is created. That means, if your time rate is Real Time and you purchase a subscription, changing the time rate to Monthly Renewal Every 30 Seconds won't take effect until the first transaction renews at the Real Time rate. You can always delete the transaction and purchase it again after updating the time rate so you don't need to wait for the transaction to renew.
Hopefully this helps. If you're still having issues, please file a Feedback Report and include the version of the platform you're testing with, whether it is a real device or a simulator, the version of Xcode you're using, and detailed steps to reproduce the issue.
Thanks a lot for the reply. This was helpful. After changing "Monthly renewal rate to every 30 seconds" and making the purchase in the simulator, my weekly renewal subscription code is working. I think it would be nice to be able to set a renewal rate relative to weekly/yearly subscriptions in a more intuitive fashion, but at least this works. The autorenewable subscription code is triggered, but for my weekly subscription, the expiration date is actually not advanced a week into the future.
For example here are two expiration date values in the separate in app purchase receipts after a renewal:
2022-05-02 21:23:10 +0000 2022-05-02 21:20:47 +0000
So in my UI I have an area:
"Subscription expires on 5/02/22"
After each renewal, this UI refreshes. But because the way Storekit testing works the label never actually changes. It would be cool if the expiration date in the receipt refreshed from 5/02/22 to 5/09/22 and so on, which would make a more realistic test environment.