iOS - 获取应用内订阅购买的到期时间 [英] iOS - Getting expiration time of in-app subscription purchases

查看:646
本文介绍了iOS - 获取应用内订阅购买的到期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iOS应用中,我提供了应用内购买订阅。为了使用该应用程序,他们必须购买订阅,然后才能使用。

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.

首次购买订阅后,我会立即发送验证收据请求。在该收据中,我正在提取expires_date值(自1970年以来以毫秒为单位)并将其转换为日期并将其存储在 NSUSerDefaults 中。

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.

如何识别到期日期?

推荐答案

沙箱应该按照以下方案返回到期日期。

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

这是来自 iTunes Connect开发人员指南的第164页

如果不能以这种方式工作,您可能需要提交错误报告。

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

这篇关于iOS - 获取应用内订阅购买的到期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆