iOS in-app-purchase restore returns many transactions

前端 未结 1 981
既然无缘
既然无缘 2020-12-18 11:03

When I am restoring my previous purchase. Storekit is calling updateTransations with large number of previous transactions. Don\'t know why it is r

相关标签:
1条回答
  • 2020-12-18 11:51

    There have been a lot of complaints about using updateTransactions for restoring. The below code will work but it requires the user to enter in their username and password. (for now developers have been sticking this in a IBAction call which requires a button)

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

    Then the below delegate is called.

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

    I want to know how to do this without putting a "restore" button on my interface if there are no items that need to be restored.

    0 讨论(0)
提交回复
热议问题