问题描述
这是我第一次使用 Store Kit,一切都很顺利,直到我尝试恢复购买.我已经看过其他几篇关于堆栈溢出的关于类似问题的帖子,但我没有找到适合我的解决方案.
This is my first time using Store Kit and everything has gone great up until I attempt to restore purchases. I've seen several other posts on stack overflow about similar issues but I've not found a solution that works for me.
我的应用中有一个按钮调用 [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]
.这反过来会触发 SKPaymentTransactionObserver
方法 paymentQueueRestoreCompletedTransactionsFinished:
.问题是 paymentQueueRestoreCompletedTransactionsFinished:
在返回的队列中有零个交易.
I have a button in my app that calls [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]
. This in turn triggers the SKPaymentTransactionObserver
method paymentQueueRestoreCompletedTransactionsFinished:
. The problem is that paymentQueueRestoreCompletedTransactionsFinished:
has zero transactions in the returned queue.
如果我随后尝试进行购买,我会收到通知说我已经购买了.这告诉我商店知道我的测试 Apple ID 已在之前的尝试中成功购买.为什么 paymentQueueRestoreCompletedTransactionsFinished:
在它的队列中返回一个空的交易集合?
If I then attempt to make the purchase I am notified that I have already made the purchase. This tells me that the store knows that my test Apple ID has successfully made the purchase on a previous attempt. Why then does paymentQueueRestoreCompletedTransactionsFinished:
return an empty transactions collection on it's queue?
有人提到沙箱行为不正常,但在我上线 AppStore 之前,我需要看到它的工作情况.
There has been some mention of the sandbox behaving erratically but I need to see this working before I go live to the AppStore.
有什么想法吗?我错过了什么吗?
Any ideas? Am I missing something?
提前致谢.
推荐答案
您是否在处理 -paymentQueue:updatedTransactions:
中的交易?此回调在 paymentQueueRestoreCompletedTransactionsFinished:
回调之前获取您恢复的交易.
Are you handling the transactions in -paymentQueue:updatedTransactions:
? This callback gets your restored transactions before the paymentQueueRestoreCompletedTransactionsFinished:
callback.
您应该在 -paymentQueue:updatedTransactions:
中进行恢复处理和处理.
You should do your restore processing and handling inside -paymentQueue:updatedTransactions:
.
这篇关于paymentQueueRestoreCompletedTransactionsFinished:当它应该有交易时返回一个空队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!