【发布时间】:2019-10-22 16:43:42
【问题描述】:
我正在为我的 iOS 应用添加订阅,但遇到了一些非常烦人的不一致:
我的服务器正在监听来自 Apple 的 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 等)
Apple 是否会随机更改结构以使实施订阅更加愉快,或者是否有任何关于何时使用哪种结构的逻辑?
当然,我可以简单地调整我的服务器代码以检查 latest_receipt 是否可用 OR latest_expired_receipt 可用,但这将是一个快速而肮脏的解决方案。我更愿意了解什么时候可以期待哪些内容/结构......
【问题讨论】:
-
您好,您找到解决方案了吗?如果是,请分享
-
并非如此。我的解决方案是检查这两个字段并使用可用的字段。我没有找到关于何时使用哪个字段的信息,但似乎它们没有同时使用......
标签: ios in-app-purchase subscription in-app-subscription