4

When I am restoring my previous purchase. Storekit is calling updateTransations with large number of previous transactions. Don't know why it is returning these large amount like 100, 200 ,245, 360, 650 seems like random in every restore.

Is that happen in the sandbox only? If no, what should be the criteria of selecting the item. I have many items with the same product id?

4

1 回答 1

2

有很多关于使用 updateTransactions 进行恢复的投诉。下面的代码可以工作,但它要求用户输入他们的用户名和密码。(现在开发人员一直将它放在需要按钮的 IBAction 调用中)

[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

然后调用下面的委托。

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
     for (SKPaymentTransaction *transaction in queue.transactions) 
    {
        if ([myItem.productID isEqualToString:transaction.payment.productIdentifier])
        {
            myItem.purchased = YES;
        }
    }
}

如果没有需要恢复的项目,我想知道如何在我的界面上不放置“恢复”按钮的情况下执行此操作。

于 2012-06-27T23:56:28.323 回答