Unfinished transactions: SKPaymentTransactionObserver not called after app re-launched

Hello all,


We have an app that supports purchases in iOS from version 6.0 to the latest 9.0.2.

In all iOS release prior to iOS 9 our transaction observer is called but in iOS 9 this is no longer the case.

This issue is reproduced in Sandbox environment, don't know yet if it affects production.


Test scenario:

1. comment out all calls to finishTransaction:, build & deploy the app.

2. initiate a new purchase (in our tests, it is a consumable product)

3. Wait for login prompt, enter test account credential, proceed with Buying. So far so good, AppStore says that the purchase was successful

4. The app does not call finishTransaction because of (1), so now it's time to quit the app and re-launch it.

5. The app is re-launched, SKPaymentTransactionObserver is setup inside didFinishLaunchingWithOptions: method as advised in documentation.

6. now, we expect that the transaction observer will be called soon after start of the app but this does not happen

This is what this expectation is based on:

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/StoreKitGuide.pdf


"Test an Interrupted Transaction

Set a breakpoint in your transaction queue observer’s paymentQueue:updatedTransactions: method so you can control whether it delivers the product. Then make a purchase as usual in the test environment, and use the breakpoint to temporarily ignore the transaction—for example, by returning from the method immediately using the thread return command in LLDB.

Terminate and relaunch your app. Store Kit calls the paymentQueue:updatedTransactions: method again shortly after launch; this time, let your app respond normally. Verify that your app correctly delivers the product and completes the transaction."


So it looks like iOS 9 violates this rule -

and from this point on, the transaction started in step (2) gets lost - the only chance to make StoreKit "remember" about it is to initiate the purchase of the same

consumable product _again_. This attempt will fail with "this in-app purchase has already been bought" alert (which is expected!) and right after that StoreKit suddenly becomes aware of our previous un-finished transaction: transaction observer gets called with a single transaction with transactionIdentifier matching transactionIdentifier of the previous transaction that was started in step (2) above, its state is also correctly reported as SKPaymentTransactionStatePurchased.

Obviously, this behavior contradicts documentation and provides really bad user experience...


Any help would be appreciated!

Replies

read other posts on this forum as their problem is your problem.

So is there an answer somewhere, since we are having similar issues with SKPaymentTransactionObserver method?

I can't locate the discussion from 2015. But if you always call finishTransaction from within updatedTransactions then this never happens.

We’re experiencing similar issue on macOS now. Really hoped to follow Apple’s best practices and finish transactions only after sending receipt to the server. Submitted bug report #50132756 today, but if problem won’t be resolved soon, I think we’ll stick with PBK’s “better than best” approach – at least for the mac, as everything seems to work as expected on iOS.