iOS上的StoreKit - autorenewable订阅 - 如何知道它是否是免费试用? [英] StoreKit on iOS - autorenewable subscription - How to know whether it is a free trial or not?

查看:264
本文介绍了iOS上的StoreKit - autorenewable订阅 - 如何知道它是否是免费试用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iTunes Connect中,可以为自动续订订阅提供免费试用期。

In iTunes Connect it is possible to give a free trial period for autorenewable subscriptions.

App > Manage In App Purchases > Subscription Basic > 1 Month >  Offer a free trial?

如何在客户端获取此信息? SKProduct 没有任何关于此的信息,因为我可以看到。由于我们正在进行营销活动,因此最终用户看不到有关产品的信息有试用期非常困惑。

How can I get this information on the client? SKProduct does not have any information about this as I can see. Since we're having a marketing campaign it is very confusing for the end user to not see information about the product has a trial period.

当然可以从我维护的服务器获取此类信息,但是我们将有更新服务器和iTunes Connect的开销。所以我不接受这种答案,除非它连接到Apple的服务中检索试用期信息。

Of course it is possible to fetch this kind of information from a server I maintain, but then we'll have the overhead with updating both our server and iTunes Connect. So I don't accept this kind of answer unless it is wired up to retrieving that trial period information from Apple's services.

推荐答案

TLDR;这不可能。您需要自己管理这些信息。

TLDR; It is not possible. You need to manage this information yourself.

当您处理SKPayment时,您会收到收据。您应定期验证这些收据以进行订阅(例如,在下载新内容之前),因为用户可能已取消订阅。当用户确实取消订阅或订阅到期时,您在验证购买收据时会收到描述性错误。

When you process an SKPayment you get back a receipt. You should verify those receipts regularly for subscriptions (e.g. before downloading new content) as the user might have cancelled the subscription. When the user does cancel the subscription or the subscription expires you get back a descriptive error when verifying the purchase's receipt.

此外,收据会为您提供所需的所有信息:给定的产品,您知道您授予的试用期。因此,在进行购买时,您可以将购买收据中的购买日期存储在模型对象或NSUserDefaults或购买数据中的钥匙串中。此时您知道试用期何时到期并验证订阅是否仍然有效。如果你不能,你可能想要禁用对内容的访问,直到你能够这样做。

Moreover the receipt gives you all the information you need: for a given product you know which trial period you grant. Therefore when a purchase is made you could store the purchase date given from the purchase receipt in your model object or in the NSUserDefaults or in the Keychain alongside the purchase data. At this point you know when the trial is expired and verify that the subscription is still valid. If you can't you might want to disable access to the content until you're able to do so.

有关购买收据和订阅的更多信息,请查看< a href =http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/RenewableSubscriptions/RenewableSubscriptions.html#\"apple_ref/doc/uid/TP40008267-CH4-SW5\"rel = Apple的nofollow>应用内购买指南。

For more informations about purchase receipts and subscriptions check out the In-App Purchase Guide by Apple.

这篇关于iOS上的StoreKit - autorenewable订阅 - 如何知道它是否是免费试用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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