我正在为我的iOS应用程序添加订阅,我遇到了一些非常恼人的矛盾:
我的服务器正在监听来自苹果的DID_CHANGE_RENEWAL_STATUS通知:
{
"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_receipt和latest_receipt_info。除此之外,消息的结构是相同的("auto_renew_status": "false",auto_renew_status_change_date , expires_date_formatted,等等)。
是随机改变结构,以使实现订阅更加令人愉快,还是在什么时候使用哪种结构有任何逻辑?
当然,我可以简单地修改我的服务器代码,以检查latest_receipt、或 latest_expired_receipt是否可用,但这将是一个快速而肮脏的解决方案。我更想知道什么时候该期待什么内容/结构.
发布于 2020-10-18 09:53:12
苹果公司不断地让开发者的生活更加艰难。
正如latest_receipt通知文档中所述,顶级对象latest_receipt、latest_receipt_info、latest_expired_receipt和latest_expired_receipt_info被排定为弃用对象。这可能是通知行为不同的原因。
您应该更新代码以依赖于latest_receipt & latest_receipt_info在unified_receipt对象中。

来源:https://developer.apple.com/documentation/appstoreservernotifications/responsebody
发布于 2020-02-10 08:30:14
如果在自动更新状态发生更改时订单过期,您将获得latest_expired_receipt_info和latest_expired_receipt (这种情况包括在计费重试中的订单,以及应用程序商店在重新尝试计费期间无法更新订单,或者订单已被退回),对于其他订阅仍然有效的情况,您将得到latest_receipt和latest_receipt_info。
https://stackoverflow.com/questions/56489846
复制相似问题