简体   繁体   English

iOS6 - 从苹果服务器下载的应用内购买

[英]iOS6 - In app purchase with download from Apple server

I'm able to successfully make the inapp purchase and download the content from Apple server and use it.我能够成功进行应用内购买并从 Apple 服务器下载内容并使用它。
My In app purchase content is non-consumable.我的应用内购买内容是不可消耗的。 And so I'm providing "Restore" button in my app所以我在我的应用程序中提供了“恢复”按钮
Now when user presses "Restore" button, I'm calling the method:现在,当用户按下“恢复”按钮时,我正在调用该方法:

restoreCompletedTransactions

But here, I'm not getting the call to delegate method:但在这里,我没有接到委托方法的调用:

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions

So that I can identify the transaction object and start downloading the content again from apple server.这样我就可以识别交易对象并再次从苹果服务器开始下载内容。 Can some one help me in writing "restore" option?有人可以帮我写“恢复”选项吗?

As per apple, it says:根据苹果,它说:

// Asynchronous. // 异步。 Will add completed transactions for the current user back to the queue to be re-completed.将当前用户的已完成交易添加回队列以重新完成。 User will be asked to authenticate.将要求用户进行身份验证。 Observers will receive 0 or more -paymentQueue:updatedTransactions:, followed by either -paymentQueueRestoreCompletedTransactionsFinished: on success or -paymentQueue:restoreCompletedTransactionsFailedWithError: on failure.观察者将收到 0 个或多个 -paymentQueue:updatedTransactions:,然后是 -paymentQueueRestoreCompletedTransactionsFinished: 成功或 -paymentQueue:restoreCompletedTransactionsFailedWithError: 失败。 In the case of partial success, some transactions may still be delivered.在部分成功的情况下,可能仍会交付一些交易。

But for me, I'm not getting the call "paymentQueue:updatedTransactions" at all.但对我来说,我根本没有接到“paymentQueue:updatedTransactions”的电话。 I'm just getting the call "paymentQueueRestoreCompletedTransactionsFinished:"我刚接到电话“paymentQueueRestoreCompletedTransactionsFinished:”

You probably do not observe transaction queue.您可能没有观察到事务队列。 Make sure you have确保你有

[[SKPaymentQueue defaultQueue] addTransactionObserver:self];

somewhere before you call restoreCompletedTransactions method在调用 restoreCompletedTransactions 方法之前的某个地方

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM