问题描述
我正在从以前的iOS移植一个正在运行的应用程序,并且我在使用新的应用内购买收据时遇到了问题。
I'm porting a working application from previous iOS's and am having trouble with the new in app purchase receipts.
我们现在的工作方式是从 SKPaymentTransaction
对象获取transactionReceipt属性并将其发送到服务器验证。
The way we work now is to take the transactionReceipt property from the SKPaymentTransaction
object and send it to the server for validation.
从我可以从其他问题中收集到的信息,似乎收据现在在一个地方举行,是:
From what I could gather from other questions, it seems that the receipt is now held in one place, being :
[[NSBundle mainBundle] appStoreReceiptURL];
这里有一些我不明白的事情:
There are a few things I don't understand here :
- 现在所有购买的产品都有一张收据吗?
- 如果是这样,该文件是否会增长,增长和增长?
- 如果我想将单个产品的单个收据发送到服务器,我该怎么办?
- 是否始终将完整文件发送到服务器的唯一方法?
- Is there now one receipt for all of the purchased products?
- If so, does this file grow and grow and grow?
- If I want to send single receipts for single products to the server, how can I?
- Is the only way to send the full file to the server all the time?
非常困惑,任何帮助将不胜感激。
Very confused by this, any help would be greatly appreciated.
推荐答案
我可以通过Apple的文档收集。
From what I've been able to gather via Apple's documentation.
1)所有购买的产品都有一张收据。为了执行服务器端验证,您将整个收据发送到您的服务器,然后将其转发给Apple进行验证。请参阅Apple开发者论坛上的这篇文章(从评论13开始)
1) There is one receipt for all purchased products. In order to perform server side validation you send the entire receipt to your server, which forwards it to Apple for verification. See this post on the Apple Developer Forums (starting around comment 13) https://devforums.apple.com/thread/193893?tstart=0
2)非消耗品将永久保留在收据中,所以是的,它会增长和增长。通过调用finishTransaction完成后,耗材将从收据中懒散地移除。请参阅
2) Non-consumables will remain in the receipt forever, so yes it will grow and grow. Consumables are removed lazily from the receipt once finished via a call to finishTransaction. See https://devforums.apple.com/message/876265#876265
3)iOS6通过updatedTransactions循环并将单个收据发送到服务器进行验证的方式似乎与新的iOS7设计不一致。 Apple开发者论坛上的这篇文章建议您使用收据将整个交易列表发送到您的服务器。验证收据后,交付所有产品,并完成所有交易。
3) The iOS6 way of looping through updatedTransactions and sending individual receipts to your server for validation seems at odds with the new iOS7 design. This post on the Apple Developer forums suggests you "Send the whole list of transactions to your server with the receipt. When the receipt is verified, deliver all of the products, and finish all of the transactions." https://devforums.apple.com/message/897870#897870
4)看起来确实如此。
4) That really does seem to be the case.
如果您认为缺少iOS7文档,可以向Apple提出错误报告
If you believe the iOS7 documentation is lacking you can raise a bug report with Apple
这篇关于iOS7中不可消耗产品的服务器端收据验证和transactionReceipt弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!