首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS订阅DID_CHANGE_RENEWAL_STATUS通知: latest_expired_receipt与latest_receipt

iOS订阅DID_CHANGE_RENEWAL_STATUS通知: latest_expired_receipt与latest_receipt
EN

Stack Overflow用户
提问于 2019-06-07 07:30:51
回答 2查看 2.2K关注 0票数 12

我正在为我的iOS应用程序添加订阅,我遇到了一些非常恼人的矛盾:

我的服务器正在监听来自苹果的DID_CHANGE_RENEWAL_STATUS通知:

代码语言:javascript
复制
{
    "auto_renew_status_change_date": "2019-06-05 13:42:43 Etc/GMT",
    "environment": "Sandbox",
    "auto_renew_status": "false",
    "auto_renew_status_change_date_pst": "2019-06-05 06:42:43 America/Los_Angeles",
    "latest_expired_receipt": "ewoJIn...",
    "latest_expired_receipt_info": ⊖{
        "original_transaction_id": "10000001010101010",
        "expires_date_formatted": "2019-06-05 13:43:13 Etc/GMT",
        ...
    },
    "password": "xxxxxxxxx",
    "auto_renew_status_change_date_ms": "1559742163000",
    "auto_renew_product_id": "com.my.product",
    "notification_type": "DID_CHANGE_RENEWAL_STATUS"
}

在我的测试中,几乎所有情况下都包含一个latest_expired_receipt和一个latest_expired_receipt_info

但是,一些消息却包含了latest_receiptlatest_receipt_info。除此之外,消息的结构是相同的("auto_renew_status": "false"auto_renew_status_change_date expires_date_formatted,等等)。

是随机改变结构,以使实现订阅更加令人愉快,还是在什么时候使用哪种结构有任何逻辑?

当然,我可以简单地修改我的服务器代码,以检查latest_receipt latest_expired_receipt是否可用,但这将是一个快速而肮脏的解决方案。我更想知道什么时候该期待什么内容/结构.

EN

回答 2

Stack Overflow用户

发布于 2020-10-18 09:53:12

苹果公司不断地让开发者的生活更加艰难。

正如latest_receipt通知文档中所述,顶级对象latest_receipt、latest_receipt_info、latest_expired_receipt和latest_expired_receipt_info被排定为弃用对象。这可能是通知行为不同的原因。

您应该更新代码以依赖于latest_receipt & latest_receipt_infounified_receipt对象中。

来源:https://developer.apple.com/documentation/appstoreservernotifications/responsebody

票数 3
EN

Stack Overflow用户

发布于 2020-02-10 08:30:14

如果在自动更新状态发生更改时订单过期,您将获得latest_expired_receipt_info和latest_expired_receipt (这种情况包括在计费重试中的订单,以及应用程序商店在重新尝试计费期间无法更新订单,或者订单已被退回),对于其他订阅仍然有效的情况,您将得到latest_receipt和latest_receipt_info。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56489846

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档