我正在为一个项目工作,我需要自动更新订阅.我已经完成了后端的工作,但现在我的疑问是,“h如何获得订阅状态。如果用户取消或关闭自动更新之前,续订”。请帮帮忙。
发布于 2016-02-23 07:10:42
您需要解析应用程序内购买的收据以检查过期日期。您可以自己从NSBundle.mainBundle().appStoreReceiptURL解析它,也可以将它发送到apple,然后从JSON响应中解析它。请参阅收据验证指南
发布于 2017-01-24 04:17:51
我实现了一个小型库,以简化本地应用程序收据的工作。您可以轻松地获取表示收据(InAppReceipt)的对象,并检索活动购买/所有采购。
请随意使用。Github链接
下面是一个解决问题的例子:
import TPInAppReceipt
do {
    let receipt = try InAppReceiptManager.shared.receipt()
    //retrive active auto renewable subscription for a specific product and date
    let purchase = receipt.activeAutoRenewableSubscriptionPurchases(ofProductIdentifier: "ProductName", forDate: Date())
    //retrive all auto renewable subscription purchases for a specific product
    let allAutoRenewableSubscriptionPurchases = receipt.purchases(ofProductIdentifier: "productName").filter({ return $0.isRenewableSubscription })
} catch {
    print(error)
}https://stackoverflow.com/questions/35570194
复制相似问题