Transaction comes back after finishTransaction: has been called on it

后端 未结 10 1138
一个人的身影
一个人的身影 2020-12-08 15:06

I am using in-app purchase for an iPhone app. I have a class that acts as SKProductsRequestDelegate and SKPaymentTransactionObserver, and it\'s all

10条回答
  •  轮回少年
    2020-12-08 15:27

    This issue was also raised in the developer forums, and the general conclusion was that it was down to a difference in the handling of transactions in iPhone OS 4.0. The problem only seems to occur when there is a significant delay between receiving a notification of the finished transaction and calling finishTransaction on the payment queue. In the end we didn't find an ideal solution, but what we did was this:

    1. As soon as the transaction arrives, process it and record a value in the user preferences if processing was successful.

    2. The next time that transaction appears in the queue, which may not be until the next launch of the app, immediately call finishTransaction on it.

    Our products are "non-consumable" so it's enough to check that the product paid for is valid and error-free to safely ignore any 'undead' repeated transactions from iTunes. For consumable products one would need to save more information about the purchase, such as the original payment date, to make sure that future transaction notifications can be matched to purchases that were already processed.

提交回复
热议问题