iOS - Getting expiration time of in-app subscripti

2019-02-04 03:09发布

问题:

In my iOS app, I included in-app purchase for subscription. In order to use the app, they have to purchase the subscription and then only it will work.

I don't have any server and so I'll maintain all the data with in the app, like receipts, product details etc.

First time after purchasing the subscription, immediately, I'll send request for validation receipt. In that receipt, I'm extracting the "expires_date" value (which is in milliseconds since 1970) and converting it to date and storing it in NSUSerDefaults.

I'm getting the expired date as same date when I'm checking it. Don't know whether sandbox will send short duration date for testing purposes or will sandbox server sends expires-date only for renewed subscriptions.

How to identify the expiration date?

回答1:

The sandbox is supposed to return expiration dates in the following scheme.

This is from page 164 of the iTunes Connect Developer Guide

If it is not working this way you may want to file a bug report.