Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StoreKit restoreCompletedTransactions doesn't return any transactions

I've purchased a non-consumable product using my test user, but when I call this:

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

I don't see any transactions in paymentQueueRestoreCompletedTransactionsFinished. The code looks like this:

- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
    NSLog(@"received restored transactions: %i", queue.transactions.count);
    for (SKPaymentTransaction *transaction in queue.transactions)
    {
        [self restoreTransaction:transaction];
    }

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Your add-ons have been restored." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alertView show];
    return;
}

The log always shows "received restored transactions: 0", but I expect to see one transaction. Does anyone know why the transaction isn't being returned?

like image 243
Mark Erdmann Avatar asked Jun 16 '12 00:06

Mark Erdmann


1 Answers

Now it suddenly started working! I only changed one thing, which was to go into iTunes Connect and edit the description of my product so that the status would change from "rejected" to "pending". The strange thing is that purchasing was still working (even in the "rejected" state), and only restoring didn't work. I tried restoring immediately after that change and it didn't work, but now (about 20 minutes later), the restore is working. Changing to pending must have fixed it (after the change had some time to propagate to the StoreKit servers), or else this is some kind of intermittent StoreKit bug.

like image 50
Mark Erdmann Avatar answered Oct 28 '22 15:10

Mark Erdmann