SKPaymentQueue.default().add(payment) ignored

The very first thing I do is to register the observer.

SKPaymentQueue.default().add(self)

Then I send a SKProductsRequest and get the products.

Calling restoreCompletedTransactions() triggers paymentQueueRestoreCompletedTransactionsFinished and by that confirms the observer is setup correctly.

But when I now try to make a payment with either

SKPaymentQueue.default().add(SKPayment(product: product))

or

let payment = SKMutablePayment()
payment.productIdentifier = productIdentifier
SKPaymentQueue.default().add(payment)

not a single of the SKPaymentTransactionObserver functions is being called, nor does the user get asked to confirm the purchase or login. I see no error - nothing.

With every add transactions are queuing up (SKPaymentQueue.default().transactions) but they do not trigger any user interaction.

This is using the sandbox. The login to purchase dialog has popped up exactly once. After the login I got a failure that I need to switch AppStore territories. No idea how to do that - but one issue at a time.

Anyone got an explanation for this behaviour?

2 answers

  • answered 2019-08-15 22:30 matt

    not a single of the SKPaymentTransactionObserver functions is being called. I see no error - nothing.

    That is expected behavior. After adding a payment, you don't get an event until the user does something, like purchases. But you are not purchasing because, as you have said, nothing further happens at all (perhaps because you have some sort of issue to iron out with the app store territory).

  • answered 2019-08-16 08:45 tcurdt

    Indeed SKPaymentQueue.default().add(payment) should not get ignored. Period.

    I am not sure what happened on my machine but after a reboot things started to behave. The sign-in dialog appeared reliably and for some weird reason canceling it automatically switched territories and everything started to work. Not getting a dialog or error seems worth opening a radar for - but since I can no longer reproduce it I just leave this here for others to find when running into the same problem.

    I am still after the information of actively switching the territory if anyone happens to know.