The purchase dialog does not show up since iOS 13.4

2.2k Views Asked by At

Since iOS 13.4, the dialog for in-app purchases does not show up when the line...

[[SKPaymentQueue defaultQueue] addPayment:payment]; 

...is executed.

Pre iOS 13.4 a dialog popup showed up where the user confirmed the purchase, but now nothing. Does anyone know what might be causing this issue?

Notes:

  • It's a fullscreen game based upon libSDL and gles 3.0.
  • While 99% of the code base is C++, the in app purchases is made in Objective C++
  • It worked before iOS 13.4
4

There are 4 best solutions below

2
On BEST ANSWER

try to totally "flush" the queue once:

    - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { 
        for (SKPaymentTransaction *transaction in transactions) {

        //debug - finish all transactions to make queue empty  
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 
/*
            switch (transaction.transactionState) {
                case SKPaymentTransactionStatePurchased:
                     //your code 
                     [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                     break;

                case SKPaymentTransactionStateFailed:
                    //your code 
                    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                    break;
            }
*/
        }
    }

then after replace it back by your code and try to make purchase.

0
On

I was having the same problem, this is how I solved it.

Perform the following actions with each purchase transaction.

1- remove all IAPPayment and IAPProductRequest.

func reset() {
    requests.removeAll()
    payments.removeAll()
}

2- remove all transactions.

func cleanTransactions() {
    reset()
    for transaction in SKPaymentQueue.default().transactions {
        SKPaymentQueue.default().finishTransaction(transaction)
    }
}
0
On

You can also just reboot your device

1
On

First, ensure you're finishing transactions upon success/failure:

In our case, the old code was not calling SKPaymentQueue.default().finishTransaction(transaction) to remove it from the queue. Prior to iOS 13.4, that apparently worked fine even though the documentation says it’s required

So what would happen is the dialog would show once and the person would cancel and then from that point on the transaction would persist in the queue and automatically return as cancelled without showing the dialog again. Finishing the transaction purges it and allows the dialog to show again


If that doesn't work:

Per an Apple engineer's request, I filed a radar for this (FB7648374) with App Store logging and sysdiagnose

Please do the same: