6

I have an issue with the restoration of hosted in-app purchase content. Sometimes it works, and sometimes it doesn't work at all. My users are also reporting this issue.

I had a hard time trying to replicate it, but I managed to run into a situation when it happens.

Right now whenever I run the app on my Mac from Xcode, my store delegate is notified about two pending restoration transactions in the queue shortly after launch. And the following function is being called:

func provideContent(_ transaction:SKPaymentTransaction) {
    if transaction.downloads.count > 0 {
        GLXLogger.shared.addGeneralLog(format: "[STORE] starting download")
        SKPaymentQueue.default().start(transaction.downloads)
    }

I see the log message [STORE] starting download so I know that this code is executed. And then nothing happens. updatedDownloads is not called. I have verified that finishTransaction is also not called so this cannot possibly be interrupting normal execution.

I am basically out of ideas as to what could be causing this problem. I know that this scenario has two pending restoration transactions, but I see no reason why it should lead to such a failure. It corresponds to what I see in the logs of some of my users. For them SKPaymentQueue.default().start(transaction.downloads) is called followed by nothing happening.

I would appreciate if you could help me debug this by at least throwing some ideas as to what you think could be causing such weird behaviour.

Andriy Gordiychuk
  • 6,163
  • 1
  • 24
  • 59
  • did you try this https://stackoverflow.com/questions/6861657/finishtransaction-isnt-removing-the-transaction-from-queue?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Kamran Apr 13 '18 at 20:22
  • @Kamran firstly, I do not see how this is related to the fact that downloads are not starting. Secondly, the answer you cited is wrong. You should NOT call finishTransaction until the associated download is complete. This is taken from Apple docs https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html#//apple_ref/doc/uid/TP40008267-CH5-SW10 – Andriy Gordiychuk Apr 13 '18 at 22:50
  • Are you setting the `SKProductsRequestDelegate` ? – user1046037 Apr 18 '18 at 18:05
  • @user1046037 I do, though it is not relevant for this question. `SKProductsRequestDelegate` is responsible for processing the list of available IAPs. You probably meant `SKPaymentTransactionObserver` ;) – Andriy Gordiychuk Apr 18 '18 at 18:58
  • What’s happening on the network side of things? Is something else interfering with your app’s request? – Mrwerdo Apr 19 '18 at 13:16
  • @Mrwerdo there are no other network requests which my app is sending – Andriy Gordiychuk Apr 20 '18 at 14:55
  • What happens when you change which network your computer is on? Have you tried creating a sample project which illustrates the problem? Another option is [requesting support from an engineering](https://developer.apple.com/support/technical). It’s worth keeping your options open. – Mrwerdo Apr 20 '18 at 20:52

0 Answers0